Server has closed the connection
Thank you for your continued support.
I am having trouble with “server has closed the connection.”
Prisma does not perform a connection health check after creating a connection, right?
If the socket is closed due to TCP Idle Timeout in the network configuration or OS, rather than in the application or Prisma client, Prisma client will continue to hold the connection.
As a result, an error “server has closed the connection” occurs when executing a query, and the query cannot be executed.
Question
- Is there a way to periodically check if the connection is available on the Prisma client side? Something like this (https://github.com/prisma/prisma/issues/13264#issuecomment-1633258460)
- Is query retry processing necessary in this case? Like this (https://github.com/prisma/prisma/discussions/24490#discussioncomment-9743866)
The actual flow is as follows.
Thank you.
GitHub
DB connection health check · Issue #13264 · prisma/prisma
Problem I need to check if the app is still connected to the DB. The solution must be universal for every database. Suggested solution Enable the "provider" field as a public (or getProvi...
GitHub
How am I supposed to retry P1017: Server has closed the connection ...
Question Possibly related to this issue, but I'm confused as to how applications are supposed to gracefully handle transient DB connection errors due to things like database/pgbouncer restarts....
4 Replies
Salutations, traveler! I'm the Prisma AI Help Bot. You've reached a fork in the road: one path leads to the wisdom of the human sages (ETA: sometime today), and the other to my instantaneous insights. Which way shall we go?
Responded here:
https://github.com/prisma/prisma/discussions/27273
GitHub
"server has closed the connection" and can not retry a query · pri...
Question Thank you for your continued support. I am having trouble with “server has closed the connection.” Prisma does not perform a connection health check after creating a connection, right? If ...
Thank you for confirming my question and providing an answer!
I always use Prisma and truly appreciate the work of the maintainers!
I had another related question, so I posted it in the discussion thread.
Responded on the thread 👍