Skip to main content

Code Node

Runs custom JavaScript against upstream workflow data ($json).

Config shape (code-grounded)

  • Code lives in config.code (not config.script)
  • Optional config.timeout_ms
  • No extra node inputs are required; read from $json['node_id']

Output behavior

  • Returns matched_output: success with result when execution succeeds.
  • Returns matched_output: error with error message 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/error without checking matched_output wiring.