4 months ago
I was trying to host a web application along with PostgreSQL and Redis services. I used DATABASE_URL reference variable provided by PostgreSQL service in the docker deployment. Despite all configuration overrides, Frappe internally used "railway" as database username.
It seems Railway's internal service discovery (`postgres.railway.internal`) triggered automatic user mapping. Even forcing DATABASE_PUBLIC_URL (external hostname) didn't resolve the internal user mapping. Though the deployment were successful, the app session could not coonnect to the database since the wrong username "railway" is being used internally.
6 Replies
4 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
3 months ago
https://www.postgresql.org/docs/current/libpq-envars.html
Try setting ENV vars of PGUSER to whatever you needed! It looks like this should work
3 months ago
Thanks for the response. I tried adding the reference variables (env) and shared variables but nothing worked. Somehow, the managed postgres db is overriding the database user from 'postgres' to 'railway' (which should be just the database name).
An error occurred while installing flansa: connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:14:1fb0:c937), port 5432 failed: FATAL: password authentication failed for user "railway"
connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:14:1fb0:c937), port 5432 failed: FATAL: password authentication failed for user "railway".
3 months ago
This seems to be a password issue than username. I tried changing the username to "railway" but I got the same error. This is with postgres managed database service that is not using the credentials stored in the env/shared variables. When I deploy an application making use of postgres, the deployment is getting successful with all the necessary tables be created. But when I use the UI, I get the FATAL error.
psycopg2.OperationalError: connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:31:ab9b:4440), port 5432 failed: FATAL: password authentication failed for user "railway"
connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:31:ab9b:4440), port 5432 failed: FATAL: password authentication failed for user "railway"
dineshvijayakumar2
This seems to be a password issue than username. I tried changing the username to "railway" but I got the same error. This is with postgres managed database service that is not using the credentials stored in the env/shared variables. When I deploy an application making use of postgres, the deployment is getting successful with all the necessary tables be created. But when I use the UI, I get the FATAL error.psycopg2.OperationalError: connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:31:ab9b:4440), port 5432 failed: FATAL: password authentication failed for user "railway"connection to server at "postgres.railway.internal" (fd12:aab9:a11f:0:9000:31:ab9b:4440), port 5432 failed: FATAL: password authentication failed for user "railway"
3 months ago
I believe you can also set PGPASSWORD to something you need as well. Try and see if that works 
3 months ago
Thanks for the help. I realised that Railway is creating the default database as "railway". This is something I changed it to postgres in environment variable. This resolved problem with the deployment of the custom app I built on top of a open-source platform named "Frappe". I also added configuration to stop recreating database while it's already created when I host the postgres service
Status changed to Solved christian • 4 months ago
