Execute workflow without databasse

Describe the issue/error/question

We create workflows on an internal n8n site and export them to file.

On the production server we use n8n execute --file but it fails with Cannot add or update a child row: a foreign key constraint fails, we have fixed this by executing n8n import:workflow --separate --input=/files first, but wondering if we can skip this step.

What is the error message (if any)?

Cannot add or update a child row: a foreign key constraint fails (`xxx`.`n8n_execution_entity`, CONSTRAINT `FK_n8n_execution_entity_workflowId` FOREIGN KEY (`workflowId`) REFERENCES `n8n_workflow_entity` (`id`) ON DELETE CASCADE)

Information on your n8n setup

  • n8n version: latest
  • Database you’re using (default: SQLite): mysql
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker
      - EXECUTIONS_DATA_SAVE_ON_ERROR=none
      - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
      - EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
      - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false

Hey @attiks,

Welcome to the community :cake:

I wasn’t even aware of the execute from file option, I suspect it would need something in the database so that it can temporarily log the execution running.

@netroy do you have any thoughts on this one?

@attiks I’m unable to reproduce this issue. Can you please create a simple workflow that you can consistently reproduce this issue with, and share the JSON file with us?
That would really help a lot with narrowing down the cause, and hopefully fixing the issue :pray: .

Steps

Workflows can be found on dummy_workflow.json · GitHub

  1. Create a dummy workflow
  2. Save it
  3. Download it and rename to dummy_workflow.json
  4. Copy dummy_workflow.json to dummy_workflow_fail.json and change the id
  5. Run docker-compose exec -u node n8n n8n execute --file /files/dummy_workflow.json which will work
  6. Run docker-compose exec -u node n8n n8n execute --file /files/dummy_workflow_fail.json which returns since the Id does not exists in the database
Error executing workflow. See log messages for details.

Execution error:
====================================
Cannot add or update a child row: a foreign key constraint fails (`n8n`.`execution_entity`, CONSTRAINT `FK_execution_entity_workflowId` FOREIGN KEY (`workflowId`) REFERENCES `workflow_entity` (`id`) ON DELETE CASCADE)
QueryFailedError: Cannot add or update a child row: a foreign key constraint fails (`n8n`.`execution_entity`, CONSTRAINT `FK_execution_entity_workflowId` FOREIGN KEY (`workflowId`) REFERENCES `workflow_entity` (`id`) ON DELETE CASCADE)
    at Query.onResult (/usr/local/lib/node_modules/n8n/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:158:37)
    at Query.execute (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/commands/command.js:36:14)
    at PoolConnection.handlePacket (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/connection.js:456:32)
    at PacketParser.onPacket (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/connection.js:85:12)
    at PacketParser.executeStart (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/connection.js:92:25)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)

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