I have managed to start up an instance of n8n with config data stored in a Postgres DB. When I start this up with the
postgres user (which has ALL privileges), the instance connects 100%. When I try to connect with a user with only
SELECT, INSERT, UPDATE, DELETE privileges it does not work.
I then tried to first start up with the
postgres user, after which the tables were correctly created, and then connect to the same DB (which now contains the n8n tables) with the limited user. But, still not connecting - I suspect this is because n8n, on startup ALWAYS runs the migrations.
I have 2 questions:
(1) What are the exact permission required for the DB user?
(2) Is there a way to start the instance without migrations?
Sorry, we missed the question. I don’t have much idea about this, but maybe @krynble can help you
n8n will check if the migrations are up to date but shouldn’t reapply any of them.
In any case, with an up-to-date database you should be able to start it with basic privileges as you mentioned. Do you get any errors on your console? Or warnings?
Now to your questions:
- Other than the ones you mentioned, I am sure we also need
DROP (for rolling back), and
ALTER. Maybe under the hood TypeORM may use other properties but I am not entirely sure.
- Unfortunately no. n8n always does this as an outdated database would render n8n unusable.
@krynble, thanks for the reply!
When using the user with
SELECT, INSERT, UPDATE, DELETE permissions, I get the following error: “Error: There was an error: permission denied for table webhook_entity”.
I have tried with both
npx and running n8n inside a Docker container.
I totally get why n8n would run migrations at startup - makes perfect sense. I am just facing an issue where in our production setup, our DBA’s do not allow any permissions other than normal CRUD.
But, thanks for the feedback anyways.
That is strange.
Did n8n crash on startup or after? What action were you performing when it crashed? Were you trying to activate a workflow?
Also, maybe double checking the permissions (trying to connect with these credentials from another app or CLI) just to make sure the user has the correct permissions.
@krynble, it crashes on startup (both for
I have connected successfully with the limited privilege user to my SQL client - I can then do
INSERT, etc on the n8n tables.