Timed out fetching a new connection from the connection pool

We're using prisma on vercel, to connect to supabase with the pgbouncer. We set the connection limit to3, timout to 60sec, but we still get this error when the traffic goes up. Since its in a serverless environment, multiple function invocation can happen at the same time, and it appears Vercel somehow stops the functions (or freezes them ?) at the end of each request. I've tested many approaches to solve this issue, including large number of pool connections, tbut nothing helps. And we're paying a supabase medium instance, I"ve increased the number of connections etc.. Help ?
12 Replies
Prisma AI Help
You selected to wait for the human sages. They'll share their wisdom soon. Grab some tea while you wait, or check out #ask-ai if you'd like a quick chat with the bot anyway!
Sebosss
SebosssOP2w ago
Hi @Nurul (Prisma) by any chance, did you ever have a similar issue ?
RaphaelEtim
RaphaelEtim2w ago
Hi @Sebosss Did you try the recommendations from this docs ?
Sebosss
SebosssOP2w ago
yes I read it many times 🙁 @RaphaelEtim
RaphaelEtim
RaphaelEtim2w ago
Did you follow the guide to set the initial connection_limit initially to 1 and observe if the error appears before tuning the pool timeout? Also, can you please let us know what version of Prisma you are on?
Sebosss
SebosssOP2w ago
sry didnt receive the notification, I tried and for now it looks ok prisma v6.3.1
RaphaelEtim
RaphaelEtim2w ago
No worries. Let us know if u run into any issues again.
Sebosss
SebosssOP2w ago
We just had the issues again this morning
Sebosss
SebosssOP2w ago
Here's a stat query I ran to see the activity btw
No description
Sebosss
SebosssOP2w ago
here's the parameters we used : /postgres?pgbouncer=true&connection_limit=1&pool_timeout=10
Alan_szt
Alan_szt2w ago
I got the same issue. AWS Fargate with MySQL. https://github.com/prisma/prisma/discussions/9273 Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)
GitHub
Usage with AWS ECS Fargate: Connection pool-size for VCPU's? · pris...
Hi folks, I assume I might now be the only one who uses prisma with aws ecs containers. While it works, I realize the connection is pretty much chugging, and I wonder whether this is because of som...
Connection pool | Prisma Documentation
Prisma ORM's query engine creates a connection pool to store and manage database connections.
RaphaelEtim
RaphaelEtim2w ago
@Sebosss From the logs, you shared, i can see idle in transaction state which typically happens when a transaction is started but not completed. This can occur if a query or transaction is initiated but not properly closed or committed. Can you incrementally increase the connection_limit to see if it helps? You may also try changing the pool_timeout to say 0 or a higher number to observe as well

Did you find this page helpful?