3 months ago
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
Initializing n8n process
There was an error initializing DB
password authentication failed for user "postgres"
Last session crashed
3 Replies
3 months ago
Are you sure you're using the correct environment variables for the database for n8n?
3 months ago
yes
hironmoy05
yes
3 months ago
Hello hironmoy05!
I took a look at your logs, and please don't worry, this is a very common situation with databases and we can fix it easily.
It looks like n8n is trying to login, but the password it has doesn't perfectly match what Postgres expects right now. Even if you copied it correctly before, sometimes static text can get out of sync.
To make this stress-free for you forever, I recommend setting up a dynamic link for all your connection variables. This way, n8n grabs the details directly from Postgres automatically, so they are always perfectly synced.
Here is the full configuration to make it bulletproof:
Go to your n8n service Variables and ensure these are set. (Just replace Postgres-Service-Name with the actual name of your database service as seen on your canvas)DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=${{Postgres-Service-Name.PGHOST}}
DB_POSTGRESDB_PORT=${{Postgres-Service-Name.PGPORT}}
DB_POSTGRESDB_DATABASE=${{Postgres-Service-Name.PGDATABASE}}
DB_POSTGRESDB_USER=${{Postgres-Service-Name.PGUSER}}
DB_POSTGRESDB_PASSWORD=${{Postgres-Service-Name.PGPASSWORD}}
Here’s how it looks on my end:
Based on that, my variables are set up like this:DB_POSTGRESDB_DATABASE="${{Postgres-k7BP.PGDATABASE}}"
DB_POSTGRESDB_HOST="${{Postgres-k7BP.RAILWAY_TCP_PROXY_DOMAIN}}"
DB_POSTGRESDB_PASSWORD="${{Postgres-k7BP.PGPASSWORD}}"
DB_POSTGRESDB_PORT="${{Postgres-k7BP.RAILWAY_TCP_PROXY_PORT}}"
DB_POSTGRESDB_USER="${{Postgres-k7BP.PGUSER}}"
Why this helps? This uses what we call Reference Variables. It acts like a live bridge between the services. If your database password ever changes in the future, n8n will automatically know the new values without you needing to do anything!
You can read more about how this works here.
Give that a try and redeploy. I’ll be right here if you need any more help getting it running! 
Attachments