Please, help me with this errors, I've got several customers complaining.
✖ Introspecting based on datasource defined in prisma\schema.prisma
Error: P1017
Server has closed the connection.
I can't connect to the database, yesterday everything was working good.
28 Replies
You chose to compile with the bot. One moment while I piece together your answer…
The error
P1017: Server has closed the connection means that Prisma tried to connect to your database, but the database server closed the connection unexpectedly. This is a generic error and can be caused by several factors, including:
- Database server issues (e.g., maintenance, restarts, network problems)
- Exceeding connection limits or idle timeouts
- Changes in Prisma or database configuration
- Upgrades or changes in Prisma version (some users report issues after upgrading past certain versions)
- Database provider-specific issues (e.g., Supabase, PlanetScale, SQL Server 2016, etc.)
What you can do:
1. Check your database server logs for any errors or reasons why connections are being closed. Prisma is only reporting that the server closed the connection; the root cause is often in the database logs itself Some runs of CRONs end in error P1017.
2. Test with another database client (e.g., psql, DBeaver) to confirm if the database is reachable and stable.
3. Restart your database server if possible, as sometimes dangling or stale connections can cause this issue prisma migrate: P1017 Server has closed the connection.
4. Check for recent changes: If you recently upgraded Prisma, try downgrading to a previous version that worked (users have reported regressions after certain versions) prisma migrate dev fails with Error: P1017 (prisma > 5.9.1).
5. Network/Infrastructure: If your database is hosted in Kubernetes or behind a proxy, check for network interruptions or timeouts Prisma 6.3.1 npx prisma migrate dev causes P1017.
6. Database provider limitations: Some providers (e.g., Supabase, PlanetScale) may have temporary outages or connection limits. Sometimes, the issue resolves itself after a while PlanetScale — P1017: Serve
r has closed the connection.
If the problem persists, please gather logs from both Prisma (run with DEBUG=*) and your database, and check if any recent changes were made to your infrastructure or Prisma version. If you need further help, please provide more details about your setup and any recent changes.Hey @RDG
Can you share the email id with which you created the Prisma account?
I assume you are using Prisma Postgres
yes
bugadogc.yt@gmail.com
this is the email connected to the prisma account
everything was working fine yesterday and ive recently paid the prisma invoice, so I don't think its a payment issueIn which environment are you getting this error?
aztroagendas-dev or aztroagendas-prod?
both
This is the way I'm handling the connection
Schema:
And you are using the Direct connection string (starting with postgres://) and not the accelerate one (starting with prisma+postgres://), right?
Could you try restarting the database instance and see if it helps? You should be able to restart it from Settings tab in Prisma Console
Yes, im using the direct connection
And i already tried restarting it
It didnt work
Are you able to see the tables and your data in Studio on Prisma Console?
yes
I checked the logs and your database instance is responsive and returning data as expected 🤔
Could you try redeploying your application?
yes, the issue here is the connection, i don't know what it is, I didn't do anything different
Where is your app deployed?
vercel
but both vercel and local are closing the connection
Oh, so your app running locally is also throwing the same error?
yes
and out of the blue, a couple hours before this wasn't happening
That's very strange!
What prisma version are you using?
prisma : 6.16.1
@prisma/client : 6.16.1
the only thing I see that is different is 19 hours ago they released 6.17.0
and this last person in the chat is apparently having the same issue as me #ask-ai
Could you do a force deployment on Vercel and try?
I asked the person in #ask-ai if they are using Prisma Postgres as well.
I am checking with team internally in the meantime.
ok, thank you very much for helping me! i'll try redeploying now
Same error
Thanks for trying. I just shared it with team internally
to get insights on what could be causing this
ok, thank you. I'll wait.
I think we know what's going on. Working on it
just for extra information, the accelerate url is working fine.
as far as connection goes
@RDG Can you please check now?
yes, just a sec
working now apparently
We had an issue only in US East region causing this. We are doing a postmortem and will share the findings 🙏
Apologies for the inconvience and thank you for reporting this
Ok, thanks for you help. Just a question, is it already fixed? Can I redeploy using the postgres url instead of the accelerate one?
Yes, this is resolved