Code Node
Runs custom JavaScript against upstream workflow data ($json).
Config shape (code-grounded)
- Code lives in
config.code(notconfig.script) - Optional
config.timeout_ms - No extra node inputs are required; read from
$json['node_id']
Output behavior
- Returns
matched_output: successwithresultwhen execution succeeds. - Returns
matched_output: errorwitherrormessage on runtime/timeout failures.
Example usage snippet
{
"id": "n_code",
"type": "code_node",
"config": {
"code": "const s = $json['proxy_1']?.response?.status_code; return { is_ok: s === 200, status: s };"
}
}
Common pitfalls
- Throwing runtime errors from unchecked null/undefined values.
- Writing heavy loops that increase latency.
- Embedding secrets directly in script text.
- Branching edges from
success/errorwithout checkingmatched_outputwiring.