Code Node Not Executing/Receiving Input in n8n Cloud Workflow - Troubleshooting Assistance Needed

Dear n8n Support Team,

I am experiencing a persistent issue with a workflow on my n8n cloud instance ([your-instance-name].n8n.cloud, e.g., re-think-tank.app.n8n.cloud) where a Code node does not appear to be executing its script or receiving input, despite the preceding node seemingly outputting data to it.

Workflow Goal:
The overall goal is to automate daily trivia question generation using OpenAI, check against existing questions, format new questions, and store them in Firestore.

The Specific Problem:
The workflow proceeds successfully up to an “Edit Fields” (Set) node. The n8n canvas shows a “1 item” indicator on the connector leaving this “Edit Fields” node and entering the subsequent “Code” node. However:

  1. When inspecting the Code node’s “INPUT” panel in the workflow editor (even after clicking “Execute previous nodes”), it shows “No input data yet.”

  2. More critically, when running the entire workflow and checking the detailed Execution Logs for that run, there are no console.log() messages from the Code node , even when the very first line of the Code node’s script is a console.log() statement intended to log the received input. This indicates the Code node’s script is not being entered/executed.

  3. The workflow visually “stops” at the Code node (no green checkmark, no data output indicators on the canvas).

Troubleshooting Steps Taken (Extensive):

  1. Initial Problem with OpenAI Node: We initially used the dedicated “OpenAI” node (v1.8) which failed to produce output despite a valid API key and successful credential test.

  2. Workaround with HTTP Request Node: We successfully configured an “HTTP Request” node to call the OpenAI API directly. This node successfully receives data from OpenAI (e.g., trivia questions in choices[0].message.content).

  3. “Edit Fields” (Set) Node Added: To isolate the data passed to the Code node, an “Edit Fields” (Set) node was inserted after the HTTP Request node.

  • This “Edit Fields” node is configured with “Include Other Input Fields” OFF.

  • It’s set to create a single field, aiRawText.

  • Initially, its value was an expression to get data from the HTTP Request node (e.g., {{ $json.choices[0].message.content }}).

  • For debugging, this was simplified to a static string expression: {{ “TESTING 123” }}.

  1. Code Node Simplification: The Code node’s JavaScript was simplified to primarily log its input and attempt to access the aiRawText field:

Generated javascript

// Example of the simplified debug script in the Code node:
console.log("Code Node Input Item:", JSON.stringify($input.item, null, 2));
let rawText = null;
if ($input.item && $input.item.json && $input.item.json.hasOwnProperty('aiRawText')) {
  rawText = $input.item.json.aiRawText;
  console.log("Found aiRawText:", rawText);
} else {
  console.log("aiRawText field NOT found in input.item.json");
}
// ... (outputs a dummy item based on whether rawText was found) ...
return items;

content_copydownload

Use code with caution.JavaScript

  1. Execution Log Analysis: Despite the “Edit Fields” node showing a green checkmark and “1 item” on its output connector on the canvas during a full workflow run, no console.log messages from the Code node appear in the n8n Execution Logs for that run. The logs only show entries for nodes up to and including the “HTTP Request” node (and sometimes the “Edit Fields” node shows in the log list but without specific log messages from within its own operation if it doesn’t have console.logs).

  2. Connection Re-creation: The connection between the “Edit Fields” node and the “Code” node was deleted and re-added, with no change in behavior.

  3. Workflow Name: [Your Workflow Name, e.g., My workflow 2]

  4. Relevant Execution ID (Example): [Provide an example Execution ID where this occurred, e.g., ID#41]

Current Workflow Structure (Simplified):
Schedule Trigger → Firestore (getAll) → HTTP Request (to OpenAI) → Edit Fields (Set) → Code → Firestore (create)

Hypothesis:
There appears to be an issue with how data is being passed from the “Edit Fields” (Set) node to the “Code” node, or how the Code node is being triggered/initialized with input, specifically on my n8n cloud instance. The canvas UI indicates data flow, but the Code node’s internal state (no input visible in editor) and lack of execution logs suggest it’s not receiving or processing any actual data item.

Help Needed:
Could you please help investigate why the Code node might not be receiving input or executing its script under these circumstances? Is this a known issue, a bug in the current cloud version, or something specific to my instance/workflow configuration that we’re overlooking?

I can provide the workflow JSON and screenshots if needed. We have confirmed API connectivity and basic data retrieval with the HTTP Request node. The problem seems localized to the “Edit Fields” → “Code” node interaction.

Thank you for your time and assistance.

Hey @anon32821364 ,

I created the similar scenario on my side and i can confirm that it is working fine for me:-

I am cloud plan with version : 1.89.2

but I can also confirm it is also working fine for me on latest version also.

Not sure what is happening on your side.

Can you please try again using this workflow and share if it works for you or not?

  • All nodes get green checkmarks.

  • The “Edit Fields” node has a log message: “This is an item, but it’s empty.” (Ask him if this is expected or indicates a problem with how “Edit Fields” is working on your instance).

  • Critically: There are still NO console.log messages from the Code node appearing in the main Execution Logs section.

  • even this simplified test exhibits the same core problem: the Code node’s script doesn’t appear to run or log, despite the workflow path reaching it.

BTW - Thank you SOOO much for helping me out! I just don’t understand this problem.

1 Like

@anon32821364 ,

  1. All nodes get green checkmarks that means Everything is fine and running.
  2. In The screenshot you have shared , the log message we are seeing , that is for manual trigger log and not for edit fields.
  3. Console.log never shown in the n8n logs section, those logs are always show in the dev console of your browser (See screenshot)
  4. I don’t know, if it is a confusion or something is really not working on your side…

Since It is working okay on my side (I have checked the same thing on cloud as well as self hosted instance.)

I feel bad that you are going through this but this all what I have to share…my friend..

when “My workflow 2” is run:

  • The HTTP Request node successfully gets data from OpenAI.

  • The Edit Fields (Set) node is configured to extract choices[0].message.content into aiRawText.

  • The canvas shows “1 item” going from Edit Fields to Code.

  • No console.log messages from the Code node appear in the Browser Developer Console.

  • The Code node does not produce output.

  • Your test workflow did produce console.log messages in your Browser Developer Console from its Code node…where do I go from here?

  1. “I ran my main workflow (‘My workflow 2’) again.”

  2. “The HTTP Request node runs successfully.”

  3. “The ‘Edit Fields’ (Set) node (which extracts aiRawText from the HTTP Request output) also gets a green checkmark and shows ‘1 item’ on its output connector on the canvas.”

  4. “The Code node has a simplified debugging script starting with console.log("Code Node Input Item:", JSON.stringify($input.item, null, 2));.”

  5. “When I run the full ‘My workflow 2’ and check the Browser Developer Console , there are NO console.log messages from this Code node .” (You can share this latest screenshot showing the browser console).

  6. “This is different from when I ran Sudhanshu’s test workflow, where his Code node did produce console.log messages in my Browser Developer Console.”

  7. “In my Code node’s ‘Settings’ tab, ‘Execute Once’ is OFF, and ‘On Error’ is ‘Stop Workflow’.”

This comparison clearly shows that data flow into a Code node and its subsequent script execution (at least logging) works in a minimal new workflow on your instance, but fails in your existing, more complex workflow, even after inserting the “Edit Fields” (Set) node as an intermediary.

This might point to:

  • A subtle corruption or persistent bad state in “My workflow 2”.

  • An issue with how the very first item from your Schedule Trigger or Google Cloud Firestore (getAll) is structured that, many steps later, results in an “item” that looks like it’s flowing on the canvas but isn’t actually consumable by the Code node script.

I still need help on this - is there a direct n8n support email?