R
Railway14mo ago
Ayush

the database server at xxx.proxy.net:10037 was reached but timed out

Hi guys, i building a new project using this template: https://github.com/railwayapp-templates/nextjs-prisma I've noticed that after a few days when the web app rebuilds it fails to connect to the postgres container and as a result the build fails. It feels like this error may be a red herring because i can definitely connect to the container and see the data etc. The fix that i've been getting away with is to restart the postgres container. Then the nextjs builds fine. Any ideas?
GitHub
GitHub - railwayapp-templates/nextjs-prisma
Contribute to railwayapp-templates/nextjs-prisma development by creating an account on GitHub.
13 Replies
Percy
Percy14mo ago
Project ID: 4560af59-2514-4429-ab8a-5c25958a1a2e
Ayush
Ayush14mo ago
4560af59-2514-4429-ab8a-5c25958a1a2e
Ryan The Temp
Ryan The Temp14mo ago
I have the same problem, also with prisma. But I'm using Nuxt but probably the same underlying issue.
Ayush
Ayush13mo ago
@Ryan the Temp i managed to find a fix for this. I upgraded prisma client to 5.3.0 and set
PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK = true
PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK = true
in env variables https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_schema_disable_advisory_lock
Prisma
Prisma environment variables reference
This page gives an overview of all environment variables available for use.
Ayush
Ayush13mo ago
although im no prisma expert and i dont know what the implications are. From the docs Advisory locking is a protection mechanism for running multiple commands concurrently
elieh
elieh13mo ago
Had the same issue, that's a workaround that can have serious issues if 2 migrates run simultaneously Wondering why this happens on railway exclusively?
Ayush
Ayush13mo ago
@elieh if you only have one web app with prisma and a single instance of Postgres. Will there ever be multiple migrations running concurrently?
Ryan The Temp
Ryan The Temp13mo ago
I'm using the above workaround as well, but as @elieh mentioned, it can be destructive.
Ayush
Ayush13mo ago
@Ryan the Temp do you foresee any issues with migrations if you only have a single web app with prisma?
elieh
elieh13mo ago
@Ayush it can still happen if the migration is called twice with a single web app - simultaneous deployments or just general startup concurrency, but the chances are small
jr
jr13mo ago
This seems to be an issue with how Prisma is closing connections and is not specific to Railway databases https://stackoverflow.com/questions/76450818/supabase-prisma-migrate-dev-sometimes-times-out-postgres-advisory-lock
Stack Overflow
supabase: prisma migrate dev sometimes times out (postgres adviso...
I have a supabase database (postgres 15.1.0.88) and I'm using prisma as ORM(latest version [email protected]). When trying to apply migrations with prisma migrate dev, the command most of the times ret...
jr
jr13mo ago
We are investigating this internally to see if we can change something about the official postgres template so it doesn't happen
Ayush
Ayush13mo ago
Thank you very much!
Want results from more Discord servers?
Add your server