All nodes/Data/Code
JavaScript Code
Runs the body of async function call(input, …) { … } in JavaScript inside a Deno Worker (this is JS, NOT Python: no import/`:`/elif; use JSON.parse, ===, .map). Run data → the first argument input. Extra ports → call parameters. Network: only explicitly allowed hosts. ⚠️ DEV-only.
Type in the graph: code_javascript
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
Minimal working workflow
- Execute + Data
Runs as pasted
When to use it
Reach for this node when the transformation is not expressible with the ready-made data
nodes. template joins strings, json_set and json_filter_map reshape JSON, math_op
computes, if and switch branch, map and filter walk a list. Code is for the point
where your own logic starts: parsing an odd format, a loop that accumulates, folding a
third-party API response into a shape the rest of the graph can use. A plain text
substitution does not need code — a template reads better and has no sandbox limits.
How it works
You write the body of async function call(input, …) { … }. The signature is shown
read-only and cannot be changed. The value that arrives at the Run port becomes the
input argument; whatever you return leaves through the Success output and is read
downstream as {{ nodes.<id>.output }}.
Extra arguments come from extra ports: the Inputs tab → Custom Inputs section. A port’s
name becomes the parameter name, so it has to be an identifier (letters, digits, underscores,
starting with a letter) and cannot be input, run, nodes, inputs, variables or loop.
Two functions are available for workflow variables: get_var("name") and
set_var("name", value). Both are synchronous and work only with variables declared by a
var node in the same workflow — an unknown name throws. Written values are persisted only
after the code finishes successfully.
console.log, console.warn and console.error land in the run log, which is the main way
to debug here.
Network access is open to public hosts by default; private and loopback addresses are always blocked. The Allowed hosts field narrows egress to the names you list. The code gets 5 seconds and 128 MB by default; a plan can lower those numbers, never raise them. Code is capped at 64 KiB.
Common mistakes
- Only an exec edge reaches the node. Then
input === null— the value travels on a data edge wired into theRunport. - Python syntax. This is Deno JS: no
import, no npm packages, noelifor colons. UseJSON.parse,===,.map. - Returning something JSON cannot carry. The result is serialized as JSON, so
Map,Setand functions arrive empty — return plain objects and arrays. - Reading a variable that no node declares.
get_varrequires avarnode with that name. - Assuming a failed run is free. The sandbox ran, and the run is billed regardless of the outcome — a timeout and an empty body included.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Runrun | Execute + Dataexecute_data | — |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Successsuccess | Execute + Dataexecute_data | — |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Codecode | string | return input; | Function body only (signature and braces are shown read-only in the editor). Runner wraps this as async call(input, …); extra input ports become parameters. Must not be empty — an empty body still bills a sandbox run and returns null. |
Allowed hostsnet_allow | array<string> | — | Optional restrictive allowlist of hostnames for outbound HTTP requests. If empty, all public hosts are reachable. Private/loopback IPs are always blocked. |
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.