Why won't console.log() work in n8n Code nodes self hosted?

Problem with console.log not showing in n8n Code node

Environment

  • n8n version: 1.69.2
  • Database: Not specified
  • Installation method: npm
  • Hosting: Self-hosted on render.com (Linux)

What I’m trying to do

I’m attempting to use console.log() within a Code node in n8n to debug my workflow. While I can see n8n system logs in my browser console (like “pushing in replay queue” and “page is called”), any console.log() statements I add in Code nodes are not appearing.

What I’ve already tried

I’ve configured the following environment variables:

  • CODE_ENABLE_STDOUT=true
  • N8N_LOG_LEVEL=debug
  • N8N_LOG_OUTPUT=console

Example of logs I can see

pushing in replay queue
logUtil.js:29 page is called 
logUtil.js:29 ====== request processed successfully: 200

Example of my Code node

// Access the input JSON data
let inputData = $input.all();
console.log("DATA",inputData)
return inputData;

Questions

  1. Are Code node logs supposed to appear in the browser console, or should I be looking elsewhere?
  2. Are there additional configuration steps needed to enable Code node logging?
  3. Is this behavior different when self-hosting on render.com compared to other deployment methods?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

CODE_ENABLE_STDOUT is only needed for non-manual executions.
Since you are debugging this in the browser, your executions are manual, in which case the backend sends a websocket message to the browser to log to the browser console.
There are only reasons that I can think of that could prevent you from seeing these logs:

  1. Either your browser log-level is set exclude the log level, or
  2. Your hosting setup is messing with Websocket connections.

I don’t have any experience with Render, but I’ve seen some other posts here that look like people having issues with Websockets on Render.

Is the rest of the UI upgrading correctly for you on manual executions?

Not related to websocket the rest of the flow work normally I think the fact that this is render should not change the potential results

If you open the the “Network” tab in your browser devtools, and look for /rest/push, you can see the websocket messages.
Can you please check if you are receiving a sendConsoleMessage message for every console.log in a code node?

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.