N8n Node: Get & Create a workflow created in another version

Describe the problem/error/question

I am trying to use N8N API (Using native node) to get a workflow from my instance and recreate it inside the same instance. However, because my workflow was created on a previous version of n8n, it seems the import fails.

What is the error message (if any)?

I get a 400 error:

ERROR: Request failed with status code 400
Request failed with status code 400 - Request failed with status code 400

Please share your workflow

For the error to appear, the other workflow needs to be created in a different version.

For the error to appear, the workflow needs to be created in a previous version and having some migrated keys. For example, in the following workflow, the key “continueOnFail” has been replaced with “onError” so the import does not work

I would expect the behaviour to be the same as Export / Import, that works for nodes created on previous versions.

I also have the same problem with following settings:

  • executionOrder
  • callerPolicy

Information on your n8n setup

  • n8n version: 1.18.0
  • Database (default: SQLite): Default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 20.0.4

Hey @Henri_Chabert,

The only workflow settings we support on import at the moment are below, We should really update this to support the new options so that you don’t need to remove them or we should ignore them so there is no error.

saveExecutionProgress
saveManualExections
saveDataErrorExecution
saveDataSuccessExecution
executionTimeout
errorWorkflow
timezone

On the node setting I will look into that as that is potentially a larger issue.

Hello @Jon,

Thanks for your reply !
Indeed, it would be great if Get & Create could work without any changes.
On the node settings, keep me updated. For the moment I replace manually all legacy keys with the new ones.

Best!

I’m going to post an example here that I made to work, so you can try to use it as a basis to apply to your business.

{
  "name": "My workflow",
  "nodes": [
    {{ JSON.stringify($('n8n').item.json.nodes[0]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[1]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[2]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[3]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[4]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[5]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[6]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[7]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[8]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[9]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[10]) }},
    {{ JSON.stringify($('n8n').item.json.nodes[11]) }}
  ],
  "connections": {
    "Loop Over Items": {{ JSON.stringify($json.connections['Loop Over Items']) }},
    "HTTP Request": {{ JSON.stringify($json.connections['HTTP Request']) }},
    "Api Info": {{ JSON.stringify($json.connections['Api Info']) }},
    "Espera 15 segundos": {{ JSON.stringify($json.connections['Espera 15 segundos']) }},
    "HTTP Request1": {{ JSON.stringify($json.connections['HTTP Request1']) }},
    "EnviarTexto": {{ JSON.stringify($json.connections['EnviarTexto']) }},
    "Wait1": {{ JSON.stringify($json.connections['Wait1']) }},
    "Item Lists": {{ JSON.stringify($json.connections['Item Lists']) }},
    "Code": {{ JSON.stringify($json.connections['Code']) }},
    "split text simples": {{ JSON.stringify($json.connections['split text simples']) }},
    "Switch": {{ JSON.stringify($json.connections['Switch']) }}
  },
  "settings": {}
}

1 Like

@Henri_Chabert you have piqued my curiosity, what is your usecase? Any chance that you’re trying to test whether your workflows work correctly on a newer version before you upgrade?

Hello @maxT !
I am building a Version Control of my workflows and a deployment abiluty (A little bit of what the paying version offers but a little bit more advanced).
The goal of it is to be able to commit, release and deploy a workflow on a production instance with a Slackbot or other triggers.
Thus, I need to get workflows from my design node and push it to my production node, and, if nodes have been created on a legacy version, it fails.
I ended up replacing all fields that cause problems and it works like a charm !

On your second question, I’m not sure I understand, you would like me to try to export and import my workflow from an older to a newer version and see if it works?

Best,
Henri

1 Like

@Henri_Chabert I think my second question was a bit confusing; your answer was very insightful, thank you!

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