Trouble Connecting to PostgreSQL on Railway: "Can't reach database server" Error

benooonHOBBY

a year ago

hi

in my local computer i am able to connect to my postgresql instance, but when im uploading to railway and using the varibale DATABASE_URL i get an error Can't reach database server at viaduct.proxy.*******:****

and they are in the same environment

5 Replies

appiersHOBBY

a year ago

Hi there,

We are facing the same issue, postgres is getting connected from our localhost using connection string, but not working on railway itself.

Railway team please help, our production is stuck due to this.


a year ago

Please make sure you have all the needed environment variables in place and that you are using them correctly.


appiersHOBBY

a year ago

env variable named DATABASE_URL is referenced from running instance of postgres inside same railway project, still getting this error "Can't reach database server at `roundhouse.proxy"

and database can be accessed from our localhost using same connection string.


a year ago

Try adding a 3 second sleep before attempting a connection.


appiersHOBBY

a year ago

Great, It worked
Thanks!

Could you please tell us why this is happening?


Trouble Connecting to PostgreSQL on Railway: "Can't reach database server" Error - Railway Help Station