[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [Help](/c/help/9) # Connection Pool Timeout with Prisma and Vercel Postgres 903 views · 2 likes · 2 posts Bennett (@vantezzen) · 2024-08-07 I'm building a NextJS app with prisma and the Vercel Postgres database. Like recommended in the docs, I added this datasource to my schema.prisma: ``` datasource db { provider = "postgresql" url = env("POSTGRES_PRISMA_URL") directUrl = env("POSTGRES_URL_NON_POOLING") } ``` Generally this seems to work fine but randomly I sometimes get the error "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: 5)" from Prisma. When using another database provider I don't see those problems and there's next to no load on that website so it shouldn't reach any connection limits. I tried customizing the connection string to change timeouts or limits but that doesn't seem to work. What's the issue with the connection here? Do I have some wrong settings? Luka Hartwig (@lukahartwig) · 2024-08-07 · ♥ 2 Hey @vantezzen, thanks or reporting this issue. I was able to reproduce the problem. In my testing it occurs when Vercel Postgres goes from idle to active state. By default Vercel Postgres scales to zero after 5 minutes of inactivity. When it gets woken up is when the timeout occurs. However, this only happens with Prisma so there is some kind of issue there. I reported the problem upstream so we can find a long-term solution. In the meantime you can try these workarounds **Option A:** If you don't have much load anyway you can try using the non-pooled direct connection ``` datasource db { provider = "postgresql" url = env("POSTGRES_URL_NON_POOLING") directUrl = env("POSTGRES_URL_NON_POOLING") } ``` That seems to fix the issue. Prisma has some [recommendations](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections#without-an-external-connection-pooler) regarding connection limits that you can try as well. **Option B:** [You can configure the time Vercel Postgres waits before scaling to zero](https://vercel.com/docs/pricing/postgres#optimizing-postgres-compute-time). You can increase the suspend delay or disable it entirely. Keep in mind that this means the database is longer active and generates more Compute Hours.