Copy N8N workflow from Dev to Production Environment

Hi. My team is using N8N (self-hosted, not enterprise).
I have two N8N instances—one for development and one for production—each deployed in separate environments.

Steps:

  1. Development Environment (Example: https://n8n.dev.com)

    • I create a workflow with the following details:
      ID: "JirYUFuG......"
      Name: "Temp1"
    • Within the "Temp1" workflow, it executes (calls) another workflow:
      ID: "M1p92XJGv......"
      Name: "Temp2"
  2. Production Environment (Example: https://n8n.prod.com)

    • I copy the "Temp1" and "Temp2" workflows from the development environment to production.
    • However, when I execute "Temp1" in production, I receive an error stating that "Temp2" (ID: "M1p92XJGv......") does not exist.

Debugging Findings:

  • I discovered that when copying "Temp1" and "Temp2" to production, their workflow IDs change.
  • When "Temp1" is executed in production, it attempts to call the sub-workflow "M1p92XJGv......", but since that specific ID does not exist in the production environment, an error occurs.
  • I tried manually creating a "Temp2" workflow in production using the same ID from the development environment, but N8N does not allow workflows to be created with predefined IDs.

Question:

If I have a workflow containing 100 sub-workflows, it is impractical to manually copy 100 JSON files for each sub-workflow to the production environment and then replace every single ID in the main workflow. What can I do to deploy from development to production quickly, conveniently, and accurately?

How are workflows imported? Is it done through the interface or the shell? According to the documentation at CLI commands | n8n Docs, IDs should be transferred via the shell, and existing workflows with the same ID should be overwritten. Perhaps you could try that.

To avoid always using the shell, on self-hosted instances, shell commands can also be easily executed via a Command Node. You could set up a workflow with a Form Trigger where you can upload a workflow file, which then gets imported.

1 Like

I export N8N workflow from Dev and import this JSON file to Production

“I try to import N8N via API (POST /workflows) and manually import from a JSON file. But my problem is that I cannot create a Workflow in the Production environment with the same ID as in the Dev environment. I need the workflow IDs in both Dev and Production to be identical so that I can execute a Sub-Workflow from the Main Workflow without having to manually modify the Sub-Workflow IDs when migrating to the Production environment.”

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