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 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 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
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.
Hi @Gowthaman_Prabhu
I tried to setup Postgres DB, but I keep receiving the error "There was an error initializing DB: “connect ECONNREFUSED 127.0.0.1:5432”
I followed this configs. I also tried setting DB_HOST to localhost but still not working