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:
-
When inspecting the Code nodeâs âINPUTâ panel in the workflow editor (even after clicking âExecute previous nodesâ), it shows âNo input data yet.â
-
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.
-
The workflow visually âstopsâ at the Code node (no green checkmark, no data output indicators on the canvas).
Troubleshooting Steps Taken (Extensive):
-
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.
-
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).
-
â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â }}.
- 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
-
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).
-
Connection Re-creation: The connection between the âEdit Fieldsâ node and the âCodeâ node was deleted and re-added, with no change in behavior.
-
Workflow Name: [Your Workflow Name, e.g., My workflow 2]
-
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.