diff --git a/packages/cli/BREAKING-CHANGES.md b/packages/cli/BREAKING-CHANGES.md index 24db177b50..a60b6e29fa 100644 --- a/packages/cli/BREAKING-CHANGES.md +++ b/packages/cli/BREAKING-CHANGES.md @@ -2,6 +2,16 @@ This list shows all the versions which include breaking changes and how to upgrade. +## 1.5.0 + +### What changed? + +In the Code node, `console.log` does not output to stdout by default. + +### When is action necessary? + +If you were relying on `console.log` for non-manual executions of a Code node, you need to set the env variable `CODE_ENABLE_STDOUT` to `true` to send Code node logs to process's stdout. + ## 1.2.0 ### What changed? diff --git a/packages/nodes-base/nodes/Code/Code.node.ts b/packages/nodes-base/nodes/Code/Code.node.ts index 0b772ddda1..753cce116b 100644 --- a/packages/nodes-base/nodes/Code/Code.node.ts +++ b/packages/nodes-base/nodes/Code/Code.node.ts @@ -13,6 +13,8 @@ import { PythonSandbox } from './PythonSandbox'; import { getSandboxContext } from './Sandbox'; import { standardizeOutput } from './utils'; +const { CODE_ENABLE_STDOUT } = process.env; + export class Code implements INodeType { description: INodeTypeDescription = { displayName: 'Code', @@ -114,8 +116,10 @@ export class Code implements INodeType { 'output', workflowMode === 'manual' ? this.sendMessageToUI - : (...args) => - console.log(`[Workflow "${this.getWorkflow().id}"][Node "${node.name}"]`, ...args), + : CODE_ENABLE_STDOUT === 'true' + ? (...args) => + console.log(`[Workflow "${this.getWorkflow().id}"][Node "${node.name}"]`, ...args) + : () => {}, ); return sandbox; };