I export workflow and change his name and after I import this workflow, I don’t see any change (I even build it again)
Hi @Asaf_Shay, could provide some more context here? I assume you exported the workflow using the command from your previous question and after your changes imported the workflow using a command like n8n import:workflow --input=file.json
?
From giving this a very quick go with my local instance, I could export, change and import workflows just fine by running n8n export:workflow --id=1 --output=file.json
, then change the name
field of the first object in the array inside file.json
and then importing everything using n8n import:workflow --input=file.json
.
Would you be able to describe the steps you took in more detail and also share the file you have exported and imported?
i used from the CLI, but it doesn’t matter because the same problem happened when I used the UI
I create workflow and name him “Delete me now” and download the file
then I change the name to “Delete me later”
then I import the file , and nothing change
{
“name”: “Delete me later”,
“nodes”: [
{
“parameters”: {},
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [
250,
300
]
}
],
“connections”: {},
“active”: false,
“settings”: {},
“id”: 17
}
when I open workflow I don’t see his name
I look in the SQLite and I don’t see any changes there
Hi @Asaf_Shay, thanks for the example! It doesn’t seem like the CLI can import JSON files downloaded from the UI. It would throw an error An error occurred while exporting workflows. See log messages for details. File does not seem to contain workflows.
. The CLI is expecting an array (which is also what it would export). Once that array is present, the import does however work as expected.
Here’s exactly what I did.
- Current Status: One Workflow with ID 17 and a name of
Delete me later
.
- Exporting the Workflow JSON through the UI:
- Changing the name of the workflow directly in the file downloaded in the the previous step and wrapping the JSON object in an array:
File Content
[{
"name": "__CHANGED Delete me later",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
}
],
"connections": {},
"active": false,
"settings": {},
"id": 17
}]
- Importing the updated file using
n8n import:workflow --input=Delete_me_later.json
:
- Reloading the workflow:
The new name has now taken effect (and this would also be visible in the SQLite database).
So could you double-check whether you are getting any errors on importing the workflow?
even if I download from the UI file (JSON) he is downloaded without [] surrounding the object, it doesn’t make sense that I need to wrap every JSON that I download myself
Yes, that’s what I meant - when downloading from the UI I would have to add it myself. When using the CLI for the export, the array is already present.
So data exported through the CLI can also be imported through the CLI without any transformations.
correct me if i wrong but it’s bug
I’d say that’s design decision - JSON coming from the UI can be pasted in the UI without changes.
Data exported from the CLI can be imported by the CLI without changes. Though it would certainly be nice to make JSON from either one interchangeable without modifications. Maybe you might want to raise a feature request for this.
On your actual problem, was this solely caused by the missing square brackets? Which error where you seeing when importing your data?
I try to import the file (after I add []) and again nothing happen
Could you share the response you are getting when running n8n import
?
i import using the UI
from the cli it’s working
So you are using this option?
In this case you would not have to use the square brackets - sorry, I was just really confused as to what exactly you were doing based on your other recent questions around this topic. It would, however, not set the name of a workflow as you have noticed. Instead the UI would solely import the content of the workflow file (similar to using the Ctrl+V keyboard shortcut when you have workflow JSON in your clipboard).
ok I understand, thanks
I try to run in the CLI
n8n execute --id=4
it seems (i still check) that is working but I still get errors in the command line
There was a problem running internal hook “onWorkflowPostExecute” Error: InternalHooks not initialized
my workflow only have start node
Thanks so much for reporting this @Asaf_Shay! These hooks are relatively new, but are not relevant/required when using the CLI. So you can safely ignore the InternalHooks not initialized
error thrown by the CLI for now. I have also raised this as a bug internally, so we can work on fixing this in a future release. Please accept my sincere apologies for the inconvenience this might have caused.
Hi @Asaf_Shay, the aforementioned issue has been fixed with the 0.149.0 release
Hi @Asaf_Shay, to follow up on your question posted earlier in a new topic, could you please double-check whether the import of workflows works when importing workflows previously exported via the CLI rather than the UI?
If not, could you share examples of the files you are unable to import along with the steps you took to export them in the first place? Thanks so much!
I look here
I try import workflows when each workflow has its own file, I used --separate as it says in your DOC, and not working
I see that you are using the --separate
option but at this stage I am a bit confused how you exported your workflows in the first place. Could you share these details and ideally also an example of a workflow you have exported?
I exported using cli like this
n8n export:workflow --all --separate --output=test
the workflow is very basic, his only have start node
{“id”:18,“name”:“workflow upload”,“active”:false,“nodes”:[{“parameters”:{},“name”:“Start”,“type”:“n8n-nodes-base.start”,“typeVersion”:1,“position”:[250,300]}],“connections”:{},“createdAt”:“2021-11-15T09:43:46.199Z”,“updatedAt”:“2021-11-15T09:43:46.199Z”,“settings”:{},“staticData”:null}