n8n-code-javascript

Write robust JavaScript in n8n Code nodes with correct return formats and null checks.

4|2|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/promptadvisers/n8n-powerhouse --skill n8n-code-javascript-promptadvisers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-javascript
Source: https://github.com/promptadvisers/n8n-powerhouse/tree/main/.claude/skills/n8n-code-javascript
Command: npx skills add https://github.com/promptadvisers/n8n-powerhouse --skill n8n-code-javascript-promptadvisers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps developers write robust, maintainable JavaScript code inside n8n Code nodes, addressing data access, error handling, and integration with built-in n8n utilities.

Core Features & Use Cases

  • Data access mastery: use $input.all(), $input.first(), and $input.item correctly across All Items and Each Item modes.
  • Built-ins and integration: leverage $helpers.httpRequest(), DateTime (Luxon), $jmespath(), and $getWorkflowStaticData() for real-world workflow tasks.
  • Debugging and reliability: follow production patterns and error-prevention practices to build resilient Code node logic.

Quick Start

Create a sample Code node that sums values from all input items and outputs the total as json.

Frequently Asked Questions about n8n-code-javascript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I access input data correctly in n8n Code nodes using JavaScript?

n8n Code node JavaScript requires specific return formats depending on the mode: return an array of objects for All Items mode, and a single object with a json key for Each Item mode to prevent workflow errors.

What built-in utilities can I use inside n8n JavaScript Code nodes?

Inside n8n JavaScript Code nodes, you can leverage built-in utilities like $helpers.httpRequest() for API calls, DateTime via Luxon for dates, $jmespath() for JSON queries, and $getWorkflowStaticData() for persistent storage.

Why does my n8n Code node throw errors when handling webhook data?

n8n Code node errors with webhook data usually occur from missing null checks or incorrect return formats. You must enforce safe null checks and ensure your JavaScript explicitly returns data wrapped in the correct json structure.

Can I use JavaScript to make HTTP requests within an n8n workflow?

Yes, you can make HTTP requests within an n8n workflow by using the $helpers.httpRequest() built-in function inside your JavaScript Code node, allowing you to fetch external data and process it directly.

What is the best way to debug JavaScript logic in n8n Code nodes?

The best way to debug JavaScript in n8n Code nodes is to follow production patterns and error-prevention practices, ensuring explicit data access and safe null checks to build resilient, maintainable workflow logic.