a month ago
Hello Railway Support Team,
I'm experiencing a persistent issue with my n8n deployment on Railway and would appreciate your help.
My original n8n service crashed after regeneration of password suggested as per notice, so I created a new n8n service and a new PostgreSQL service. Although both new services sometimes show as Online, the n8n editor remains inaccessible and the deployment repeatedly crashes.
The logs have shown these errors:
EACCES: permission denied, open '/home/node/.n8n/config'
connect ECONNREFUSED ::1:5432
I've tried troubleshooting the volume permissions and configuring the PostgreSQL connection variables, but the issue remains unresolved.
Could you please help me determine why the service is failing and how to configure the deployment correctly?
Project: dependable-vibrancy
Environment: production
New n8n service: n8n-new
Database service: Postgres-new
I can provide deployment logs and screenshots if needed. Please let me know what additional information would help.
Thank you.
13 Replies
a month ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 27 days ago
mayori
Try set `RAILWAY_RUN_UID=0` in the n8n Service Variables
a month ago
I did it but it is not resolved yet.
a month ago
This is what happens when I open n8n via link given in n8n service.
a month ago
Since you created a new n8n service and a new db, I assume you don't have any data to lose, so I suggest you just start a new n8n project from a template. You can try this one: https://railway.com/deploy/n8n-5 as this uses the latest stable version pinned, unlike the others, to avoid unwanted updates on redeploys in the future.
darseen
Since you created a new n8n service and a new db, I assume you don't have any data to lose, so I suggest you just start a new n8n project from a template. You can try this one: https://railway.com/deploy/n8n-5 as this uses the latest stable version pinned, unlike the others, to avoid unwanted updates on redeploys in the future.
a month ago
Well, Thanks for your advice but I have created another fresh one DB and N8n, but it also crashed right after deployment.
darseen
Can you share the error logs?
a month ago
Yes, Please check it
a month ago
It seems like n8n is failing to connect to postgres, is postgres even healthy and running? Also, can you check the variable DB_POSTGRESDB_HOST and that its value is set to postgres.railway.internal. I just deployed the template, and everything seems to be working as expected! Can you start a brand new project with the template, and check again?
a month ago
Yes, Postgres is healthy and online. Let me apply these changings as you suggested.
darseen
It seems like n8n is failing to connect to postgres, is postgres even healthy and running? Also, can you check the variable `DB_POSTGRESDB_HOST` and that its value is set to `postgres.railway.internal`. I just deployed the template, and everything seems to be working as expected! Can you start a brand new project with the template, and check again?
a month ago
Yes, Postgres is healthy and online. Let me apply these changings as you suggested.
Yes, Postgres is healthy and online. Let me apply these changings as you suggested.
a month ago
Any updates?
a month ago
It did not work and Now I have created another template and its is working now.
a month ago
For n8n connected to PostgreSQL on Railway, the important variables include:
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=${{Postgres.PGHOST}}
DB_POSTGRESDB_PORT=${{Postgres.PGPORT}}
DB_POSTGRESDB_DATABASE=${{Postgres.PGDATABASE}}
DB_POSTGRESDB_USER=${{Postgres.PGUSER}}
DB_POSTGRESDB_PASSWORD=${{Postgres.PGPASSWORD}}
Here Postgres must match the actual database service name. Railway reference variables avoid manually copying credentials, but the exact supported variable names should be checked in that service.
Also, if the original n8n instance contains workflows or credentials, do not delete its database or persistent volume just because a fresh template works.
