How to run workflow and capture the output of all nodes

I need to run a workflow that all its nodes are of a custom node and then capture the results of all nodes outputs so I can perform some business related verifications. I used 2 approaches as below
1- Cli - n8n execute --file <WORKFLOW_FILE>. but there is no option to capture the output in another file. it is just printed in console
2- I copied the code of execute.ts and refactored it to un run workflow method and be able to capture the output but I always receive the error Cannot read properties of undefined (reading 'split') at these lines const binaryDataConfig = config.getEnv('binaryDataManager'); await BinaryDataManager.init(binaryDataConfig, true);

And when I comment out these 2 lines I get this error Error: Binary Data Manager not initialized at Function.getInstance (F:\ObjectiveIntegrateAutomation\nexus-node-integration-tests\node_modules\n8n\node_modules\n8n-core\src\BinaryDataManager\index.ts:40:10) at InternalHooksClass.onWorkflowPostExecute (F:\ObjectiveIntegrateAutomation\nexus-node-integration-tests\node_modules\n8n\src\InternalHooks.ts:177:22) at F:\ObjectiveIntegrateAutomation\nexus-node-integration-tests\node_modules\n8n\src\WorkflowRunner.ts:176:45 at processTicksAndRejections (node:internal/process/task_queues:96:5)

Any clue who to approach running a workflow and capture all nodes output not just the last one please?

@Wessam.hessien There are ENV variables that can be set for n8n instance:

Whether to save progress for each node executed (true) or not (false). It is default false.

Might be worth trying setting this env to true and then start your cli process.

@Wessam.hessien I was able to extract all nodes output from DB. I use a Postgres instance as DB for n8n. But the data could be hard to read depending on what your nodes return.

First set the following env variable to true: EXECUTIONS_DATA_SAVE_ON_PROGRESS

You can then get the data from table execution_entity column data

If you are using default SQLite as DB go ahead and setup Postgres:

1 Like

Hey @Wessam.hessien,

If you need to use the output in your own application a quick solution could be to write the data out to files that you can read but if you are going for a testing framework of some kind for your nodes if you know what the expected output is you could always use an If node in the workflow to compare and if it doesn’t match your expected result you could add a line to a response variable and collect them all for the end.

Another option could be to use an execute command node after each workflow and have it output the previous node data to something else to handle.

@jon Do you know how is it possible to capture the output data of workflow to write to a file? using CLI execute only prints the output to console and unfortunately it does not accept out file argument to write the output to a file

@Gowthaman_Prabhu Great I will try this out, but there is no way to capture the output as a return value after running the workflow?

Actually I was able to capture the output but unfortunately I get the error of “unhandled promise rejection - Binary Data was not initialized” as well

You would need to add in a write to file node in your workflow, If you wanted to output the CLI data to file though you should be able to just add >> file.txt to the end of the command.

1 Like

Another question please … any clue what do I need to do for Binary data manager to be initialized successfully? Am I missing any configs settings?

I always get the error Binary Data Manager already initialized when I get Active executions


Hi @Gowthaman_Prabhu
I tried to setup Postgres DB, but I keep receiving the error "There was an error initializing DB: “connect ECONNREFUSED”

I followed this configs. I also tried setting DB_HOST to localhost but still not working


Thanks a lot … this worked for me

@Wessam.hessien you have to create a database named n8n and a schema also named n8n. Try to connect after.