So I need to migrate from sqlite to Postgres. I´m running n8n installed with npm and pm2.
Workflow export works, credential export works aswell, credential clear output doesn´t work (It says wrong encryption key, even though it never changed).
Stopping n8n, adding new database connections and starting again with pm2 works. Tables are created, etc.
Now the weird. By using command line to import workflows, everything seems to be successful, BUT instead of importing workflows into Postgres a new sqlitedb is created. O_0
Describe the problem/error/question
Any Idea what is causing this?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
**n8n version:1.44.1
**Database (default: SQLite):SQLite to Postgres (Aurora)
Have you added the env options for the new database before doing the import? PM2 can also be tricky and doesn’t always pick up new env options so you need to force it.
yes, I´m adding the env option to ecosystem.config.js, than I perform a pm2 update. As said - creating the new tables in Postgres is fine. Performing the import of workflow and credentials creates a new sqlitedb.
That sounds very odd, When you run the import command though are you setting the same env options on your machine before running the n8n command as pm2 only handles the env options as a service not a one off command.
2: Second:Stopping n8n with pm2 stop ecosystem.config.js, adding new env option to ecosystem.config.js. Than pm2 update to pick up new option, starting with pm2 start ecosystem.config.js.
This works fine, n8n starts properly, I can setup new user etc aka fresh install on Postgres.
3: Import Workflows and credentials via n8n import.
4: Restart n8n with pm2 restart ecosystem.config.js. N8N starts again with setup screen due to new created sqlitedb. No workflow imported to Postgres and aswell none imported to sqlite (I guess no user, no workflow).
It doesn’t matter if it is the same machine, PM2 will only set the env options for what it is running so if you were running the n8n import command outside of pm2 it won’t have those env options available to it so you would need to make sure you set them in your shell before running the n8n command.