npm registry inside custom action handlers.
Choose between Web APIs, Bun APIs, and packages
- Use standard Web APIs such as
fetch,Request,Response,Blob, streams, and Web Cryptography APIs when they cover the task. - Use Bun’s built-in runtime APIs for files, image processing, Markdown, hashing, compression, and other common server-side work. The Bun 1.4 release notes list the APIs available in this runtime.
- Install packages from the
npmregistry when you need another library. Bun supports ESM, CommonJS, Node.js module resolution, and manynode:*APIs, but it isn’t completely compatible with Node.js. Check Bun’s Node.js compatibility table when a package depends on a specific Node.js API.
Install dependencies and types
Install and lock every imported package before deployment:Bun global, install its TypeScript definitions:
"types": ["bun"] in compilerOptions. Keep any other type packages your project already lists. See Bun’s TypeScript configuration.
Process images with Bun.Image
Bun.Image provides a Sharp-shaped, native image pipeline without an external package or native add-on build. On the Automate.ax Linux runtime, it can decode, resize, rotate, and encode JPEG, PNG, and WebP images.
Use it inside an action handler so the I/O and processing happen during execution:
markSignificant keeps the successful run in the default Recent runs view.
Feed Bun.Image validated bytes rather than a request-supplied filesystem path, and set maxPixels before decoding to reject decompression bombs.
Finish work inside the action handler
An action must finish its work before its handler returns. Don’t start a long-lived server, background process, orBun.cron job and expect it to continue afterward. Use Automate.ax triggers such as onSchedule for durable scheduling.
The runtime can’t modify the deployed project files. Use /tmp for temporary files, or keep data in memory. Custom code doesn’t receive Automate.ax database credentials or the Lambda execution role’s AWS credentials. Use integration accounts or credentials you explicitly provide for external services.