Restore Workflow from JSON through n8n block

Describe the problem/error/question

Using the ‘create: workflow’ n8n node, I am trying to use the JSON from a workflow backed up with GitLab, and I get: “NodeApiError: Internal error”.

As per API reference | n8n Docs, my JSON should contain “name”, “nodes” (array), “connections” (object), “settings” (object).

I am removing any other fields from the backup, keeping just the above 4, with their respective type, and the error is still thrown:

What is the error message (if any)?

{
  "errorMessage": "Internal error",
  "errorDetails": {
    "rawErrorMessage": [
      "Internal error"
    ],
    "httpCode": "none"
  },
  "n8nDetails": {
    "nodeName": "Restore Workflow",
    "nodeType": "n8n-nodes-base.n8n",
    "nodeVersion": 1,
    "resource": "workflow",
    "operation": "create",
    "itemIndex": 0,
    "runIndex": 0,
    "time": "08/07/2024, 23:39:31",
    "n8nVersion": "1.48.3 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: Internal error",
      "    at RoutingNode.runNode (/app/code/node_modules/n8n-workflow/src/RoutingNode.ts:316:11)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Workflow.runNode (/app/code/node_modules/n8n-workflow/src/Workflow.ts:1468:11)",
      "    at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1059:27",
      "    at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1762:11"
    ]
  }
}

Please share your workflow

Share the output returned by the last node

{
  "errorMessage": "Internal error",
  "errorDetails": {
    "rawErrorMessage": [
      "Internal error"
    ],
    "httpCode": "none"
  },
  "n8nDetails": {
    "nodeName": "Restore Workflow",
    "nodeType": "n8n-nodes-base.n8n",
    "nodeVersion": 1,
    "resource": "workflow",
    "operation": "create",
    "itemIndex": 0,
    "runIndex": 0,
    "time": "08/07/2024, 23:03:44",
    "n8nVersion": "1.48.3 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeApiError: Internal error",
      "    at RoutingNode.runNode (/app/code/node_modules/n8n-workflow/src/RoutingNode.ts:316:11)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Workflow.runNode (/app/code/node_modules/n8n-workflow/src/Workflow.ts:1468:11)",
      "    at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1059:27",
      "    at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:1762:11"
    ]
  }
}

Information on your n8n setup

  • n8n version: 1.48.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Unsure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Cloudron in Azure
  • Operating system: Ubuntu 2204

hello @andreid

Set the expression as

{{ JSON.stringify($json) }}

in the last node

3 Likes

worked like a charm, many thanks @barn4k