Execute JavaScript
Use this action when a step needs custom logic that CEL cannot express — reshaping data, computing values, or calling an API with code.
Best for
- Transforming JSON from earlier steps into exactly the shape a later step needs
- Calculations, parsing, and validation beyond what CEL expressions can do
- Small integrations using
fetchwhen the HTTP request action is not flexible enough
Main fields
| Field | What it does |
|---|---|
| JavaScript code | The code to run. It is wrapped in an async IIFE, so you can use top-level await and end with return <value> to produce the step result |
| Input Data | Optional CEL expression evaluated before execution. The result is available inside the code as the input variable |
| Purpose | Optional label for what the code does, shown in logs |
| Timeout (ms) | Execution time limit in milliseconds. Defaults to 5000 and is capped at 30000 — code that runs past it (including infinite loops) is terminated |
| Memory limit (MB) | Sandbox memory limit. Defaults to 128 MB, between 8 and 256 |
The code runs in an isolated V8 sandbox on a separate execution service. There is no access to Node.js APIs (require, process, file system) — only standard JavaScript built-ins plus three bridges:
input— the evaluated Input Data valueconsole.log/info/warn/error— captured and returned as thelogsoutput (up to 200 entries of 2,000 characters each)fetch(url, options)— SSRF-guarded HTTP (private and internal addresses are blocked) returning{ok, status, statusText, body}, withbodyparsed as JSON when possible and returned as text otherwise
What later steps can use
step(N).data— the value youreturnstep(N).logs— the captured console outputstep(N).executionTimeMs— how long the code ran
Tips
- Always
returnsomething — the return value is copied out of the sandbox, so keep it JSON-friendly. - Use
console.logwhile building the step; thelogsoutput is the easiest way to debug. - If the code throws, the step fails with
code_execution_failed; running past the timeout fails withcode_execution_timeout. - Each
fetchcall is bounded by the step's timeout as well, so keep third-party calls well within the time budget.