Issue with n8n deployment – Database authentication failed
romajon-c137
HOBBYOP

3 months ago

Hello Railway Support Team,

I’m experiencing an issue with my n8n deployment on Railway. After redeploying my project, the service fails to start due to database authentication errors.

Here are the details:

  • Project: mellow-connection

  • Service: Primary (n8n)

  • Database: Postgres-ep_8

Error from logs:

password authentication failed for user "railway"
There was an error initializing DB

What I’ve checked so far:

  • The environment variables in the Primary service match the credentials shown in the Postgres-ep_8 service (host, user, password, database, port).

  • Both services show the same user (railway) and password.

  • Host is set to postgres-ep_8.railway.internal.

  • I redeployed the service multiple times, but the error persists.

It seems like n8n is either not picking up the correct variables or Railway is rejecting the authentication despite correct credentials.

Could you please help me understand why this is happening and how I can resolve it?

Thank you in advance for your support.

$10 Bounty

3 Replies


Railway

Hey there! We've found the following might help you get unblocked faster: - [🧵 n8n Crashing – Redis Connection Issue](https://station.railway.com/questions/n8n-crashing-redis-connection-issue-6751fe10) - [🧵 n8n service consuming excessive memory and unable to restart - Postgres in recovery mode](https://station.railway.com/questions/n8n-service-consuming-excessive-memory-a-7f24105d) - [🧵 URGENT: PostgreSQL Service Fails to Start with Existing Volume - n8n Deployment Down Due to Authentication Mismatch](https://station.railway.com/questions/urjent-postgre-sql-service-fails-to-star-5c0726fb) - [🧵 password authentication failed for user "postgres"](https://station.railway.com/questions/password-authentication-failed-for-user-2c51edb9) If you find the answer from one of these, please let us know by solving the thread!

romajon-c137
HOBBYOP

3 months ago

none of the methods helped


brody
EMPLOYEE

3 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 3 months ago


jack
PRO

3 months ago

Do your Primary service variables look anything like this and include the following?
DB_POSTGRESDB_DATABASE="${{Postgres.POSTGRES_DB}}"

DB_POSTGRESDB_HOST="${{Postgres.PGHOST}}"

DB_POSTGRESDB_PASSWORD="${{Postgres.POSTGRES_PASSWORD}}"

DB_POSTGRESDB_PORT="${{Postgres.PGPORT}}"

DB_POSTGRESDB_USER="${{Postgres.POSTGRES_USER}}"

DB_TYPE="postgresdb"

Did you use any templates to deploy this project or individual services used by n8n? If not, if you don't have any data inside or haven't used it before, I'd suggest either using one of the two templates I've created - either https://railway.com/deploy/n8n-with-workers for the base primary service and worker service, or https://railway.com/deploy/n8n-with-webhook-processors, the same stack, with an individual webhook processor service.

If you did use one of those templates, another template, have those same variables, or don't prefer to deploy a template (easiest option), let me know and I can try to help provide further support for your current project.


Loading...