Can't connect to postgres using internal URL
kishmiryan-karlen
HOBBYOP

a year ago

Hi, I'm experiencing an error similar to this one: https://help.railway.com/questions/suddenly-can-t-connect-privately-using-p-0f1537ab

I'm trying to connect to my Postgres instance from my application using the internal URL: postgres.railway.internal:5432, however it fails at build time. My app is using Prisma and my build command is running "npx prisma migrate deploy" along with the app build. It's failing with the below error:

Error: P1001: Can't reach database server at postgres.railway.internal:5432

I've tried the solutions in the above thread - 1. putting "sleep 3" before my build command and 2. set "ENABLE_ALPINE_PRIVATE_NETWORKING"="true" for the app. Unfortuantely neither of them did help.

Please note, that the public URL is working fine.

Please kindly help to resolve this issue.

Thank you!

Solved

3 Replies

For database migrations, please use pre-deploy commands: https://docs.railway.com/guides/pre-deploy-command


Status changed to Awaiting User Response Railway about 1 year ago


kishmiryan-karlen
HOBBYOP

a year ago

Thanks a lot @ray-chen, that fixed it! And I don't even need the "sleep 3" and the flag.


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

You shouldn't need sleep 3 or the alpine variable anymore, those where fixes specific to the Legacy runtime.

Check your service settings for a runtime option, if you don't have a runtime option, then you are on the V2 runtime where no such issues exist.


Status changed to Awaiting User Response Railway about 1 year ago


Status changed to Solved brody about 1 year ago


Loading...