6 months 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!
3 Replies
6 months ago
For database migrations, please use pre-deploy commands: https://docs.railway.com/guides/pre-deploy-command
Status changed to Awaiting User Response Railway • 6 months ago
6 months 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 • 6 months ago
6 months 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 • 6 months ago
Status changed to Solved brody • 6 months ago