n8n-io/n8n

console message causing problems for stdout of n8n cli

jmls opened this issue · 2 comments

jmls commented

Bug Description

When using the n8n cli, we're now getting a message "User settings loaded from ... " before any output

If you have a program that expects just the json output (as we do) or you want to pipe that output through another process then you have an extra non-json line to have to remove

This message is only output in a non-test environment

packages/core/src/InstanceSettings.ts

const inTest = process.env.NODE_ENV === 'test';
[snip]
if (!inTest) console.info(`User settings loaded from: ${this.settingsFile}`);

To Reproduce

  1. n8n export:credentials --all

Expected behavior

only the output of the cli command should show in the console, not any "debug" info

Operating System

Ubuntu Linux 22.04

n8n Version

1.35.0

Node.js Version

18.20.0

Database

SQLite (default)

Execution mode

main (default)

Hey @jmls,

I will have a think about this one and how we handle it, technically nothing is broken here as the cli doesn't exclusively output JSON so we don't have anything to fix which would make this more of an enhancement than a bug.

It does however make sense that we don't show the extra information when used with some output options.

jmls commented

Thanks, it was more of a change in behavior that then broke our processing that's the problem.