Lesson 4: Test the Worker
Run this command:
Copied to your clipboard$> aio app run
After a few seconds it will open Asset Compute Devtool in your browser. In that tool, test your worker without AEM.
Since our worker requires imgix
parameter as you can see at line 34 in the worker code, you need to provide it in
the worker request object as shown on the screenshot. That parameter must be an escaped JSON. For instance, use the
parameters below to resize an image to 300x300px:
Copied to your clipboard"imgix": "{ \"h\": 300, \"w\": 300}"
Then run your worker and observe results on the right-hand side of the Asset Compute Devtool:
To let AEM use our worker, deploy the app by running the command:
Copied to your clipboard$> aio app deploy
As a result of that command, you will get the URL of your worker, similar to the example below. Write down the URL, since we will need to put it in our AEM configuration.
Copied to your clipboardYour deployed actions are:-> dx-asset-compute-worker-1/__secured_my-worker-> https://99999-myassetcompute-dev.adobeioruntime.net/api/v1/web/dx-asset-compute-worker-1/my-workerWell done, your app is now online 🏄