Timed out fetching a new connection from the connection pooler (timeout: 10, limit: 9)
I am getting this upon my very first call to the data from prisma. My connection url is a supabase pooler.
4 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
This error—“Timed out fetching a new connection from the connection pool (timeout: 10, limit: 9)”—when using a Supabase pooler as your Prisma connection URL, is a known issue that has affected many users, especially with Supabase, PgBouncer, and serverless or resource-constrained environments.
Key points and troubleshooting steps:
1. Connection Pool Limit: Prisma’s connection pool is limited by the
connection_limit parameter in your connection string. If all 9 connections are busy or not released properly, new queries will wait up to the pool_timeout (default 10s) before throwing this error. This can happen even on the first call if connections are not being established or released as expected, or if there’s a race condition or network issue between Prisma and Supabase’s pooler [Prisma Docs].
2. Supabase Pooler Issues: There are reports that with Supabase’s pooler (Supavisor), connections can be dropped between the database and the pooler, but Prisma is not always able to detect this, causing it to hang or throw timeouts even when the database itself is not at its connection limit. This is especially common in serverless or edge environments [GitHub Issue].
3. Immediate Timeout: Some users report the error occurs instantly, not after 10 seconds, suggesting a deeper issue with connection handling or a race condition in Prisma’s query engine, especially when using PgBouncer or Supabase poolers [GitHub Issue].
Workarounds and Recommendations:
- Try setting pool_timeout=0 in your connection string to disable the timeout (queries will wait indefinitely, so use with caution) [[Prisma Docs](<https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool#connection-pConnection pool | Prisma Documentation
Prisma ORM's query engine creates a connection pool to store and manage database connections.
ool-timeout>)].
- If possible, test with a direct database connection (not via the Supabase pooler) to see if the issue persists.
- Ensure you are using the latest Prisma version, as fixes are being released for these issues.
- If you are on Supabase, consider reaching out to their support, as some issues may be on their side.
If the problem persists, it may be a bug or limitation in the current Prisma/Supabase integration, and you may need to follow ongoing GitHub issues for updates [GitHub Issue].
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Continuing conversation here:
https://discord.com/channels/937751382725886062/1393414503248564346/1393414503248564346