Code Node (& Function Node)
The Code Node runs synchronous JavaScript in a QuickJS sandbox. No async, no network, no modules.
Written By pvdyck
Last updated 22 minutes ago
Code Node (& Function Node)
The Code Node lets you run custom JavaScript logic inside your workflow. On indie.money, it runs inside a QuickJS sandbox -- a lightweight JavaScript engine with significant constraints.
Modes
Available Built-ins
Key Limitations
- No async/await -- All code must be synchronous
- No fetch / HTTP -- Cannot make network requests (use HTTP Request Node instead)
- No require / import -- No external modules available
- No console.log -- Use
returnto output data; logs are discarded - 2-minute CPU limit -- Execution stops after 2 minutes of CPU time
- No file system access -- Cannot read or write files
- JavaScript only -- Python mode (available in standard n8n) is not supported
Example (Run Once for All Items)
const items = $input.all();return items.map(item => ({ json: { ...item.json, price_usd: (item.json.price_cents / 100).toFixed(2) }}));Example (Run Once for Each Item)
return { json: { fullName: $json.firstName + ' ' + $json.lastName, processed: true }};Debugging Tips
- Return intermediate values to inspect them in the output panel
- Use
JSON.stringify()to inspect nested objects - Test logic locally in a browser console first (no async constraints there)