prisma: Prisma client can't reach database server randomly
Bug description
Hello,
On March 2nd, 2025, we started encountering the “Can’t reach database server at DB_URL” error (PrismaClientKnownRequestError, code: P1001). Our database metrics indicate that the database itself is healthy, and according to the logs, these requests don’t appear to be reaching the database (though it’s possible we’re not looking at the correct logs). This error occurs sporadically throughout the day.
We upgraded our Prisma version to V6 on March 10th, and since then, the frequency of this issue has increased (see the attached screenshot for reference).
I reviewed a related GitHub issue, but it seems no definitive solution was provided: GitHub Issue #12305.
Questions:
- When does the “Can’t reach database server” error typically occur? Given that our database is functioning properly, is there a possibility that another underlying error is being wrapped as the P1001 error?
- What steps can we take to resolve this issue?
Your insights would be greatly appreciated.
Severity
🚨 Critical: Data loss, app crash, security issue
Reproduction
Cannot reproduce it deterministically at the moment. It’s randomly happening throughout the day.
Expected vs. Actual Behavior
We should be able to reach our database if our database is healthy.
Frequency
Intermittent / Random
Does this occur in development or production?
Both development and production
Is this a regression?
This started happening in March 2nd 2025. We upgraded prisma version to 6 on March 10th, but the issue is still happening. More details provided in prisma version section.
Workaround
There is no work around right now. We are constantly facing production issues.
Prisma Schema & Queries
// Add relevant schema.prisma snippet
// Add relevant Prisma Client query
There is no specific pattern on the queries. Lot of different queries are having this issue.
Logs & Debug Info
Couple examples:
Invalid `prisma.shift.findFirst()` invocation:
Can't reach database server at `<DB_URL>`
Please make sure your database server is running at `<DB_URL>`.
PrismaClientKnownRequestError:
Invalid `prisma.tag.findMany()` invocation:
Can't reach database server at `<DB_URL>`
Please make sure your database server is running at `<DB_URL>`.
Environment & Setup
- OS: node:22.14-bookworm-slim (Debian)
- Database: PostgreSQL
- Node.js version: v22.14.0
- Framework: Nest v10
Prisma Version
// Prisma version output
Until March 10th 11:46am: “@prisma/client”: “5.21.1”
Starting March 10th 11:46am: “@prisma/client”: “6.4.1”
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 11
- Comments: 27 (6 by maintainers)
Hey guys, I have the same problem, when running running in parallel a script that creates a tons of connections it says:
To reproduce it I just created a script like that
And started it in parallel 10 times
This is very problematic since 10% of my crons are now failing due to this error
By the way I tried the exact same strict with
pgand I encountered didn’t encountered any issueUsing the
pgadapter seems to work fine 👍Hey just chiming in to see we also see this regularly, on the order of a couple times per week. We are using the rust query engine on ec2 with postgres on RDS and we do not see the errors for any of our other applications, only prisma. I’ve tried to track this down before and haven’t been able to repro, so not able to help there unfortunately. This issue existed both on prisma v5 and prisma v6 for us
@rharkor Sorry to bother you but did you have to configure SSL certification to use the adapter? We were using default prisma set up and when I try
pgadapter, I am getting following error. I assume I can set up the SSL certification but was curious if it was necessary since we didn’t have to do this with prisma built in driver:My main confusion is that it used to work without any set up without the adapter. @FGoessler you might have some insights here?