prisma-connection-pool-exhaustion

Configure Prisma connection limits and pooling for serverless functions.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/xxih/ai-harness-zh --skill prisma-connection-pool-exhaustion-xxih
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-connection-pool-exhaustion
Source: https://github.com/xxih/ai-harness-zh/tree/main/references/translations/claudeception/examples/prisma-connection-pool-exhaustion
Command: npx skills add https://github.com/xxih/ai-harness-zh --skill prisma-connection-pool-exhaustion-xxih

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Serverless functions often create a new Prisma client on each cold start, each opening multiple database connections. This quickly exceeds the connection limits of hosted databases, leading to errors such as P2024: Timed out fetching a new connection from the pool or too many connections for role.

Core Features & Use Cases

  • External connection pooling: Integrate services like PgBouncer or Prisma Accelerate to mediate connections between serverless functions and the database.
  • Prisma connection limits: Set a low connection_limit per client and enforce singleton patterns to keep connection counts low.
  • URL parameter tuning: Add pooling and timeout parameters to the database URL for fine‑grained control.
  • Applicable scenarios: Deployments on Vercel, AWS Lambda, Netlify, or similar platforms using PostgreSQL, MySQL, or other hosted databases.

Quick Start

Ask the skill to configure Prisma with a single connection limit and enable a pooled database URL for your serverless deployment.

Frequently Asked Questions about prisma-connection-pool-exhaustion

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Prisma connection pool exhaustion happen in serverless functions?

Prisma connection pool exhaustion occurs in serverless because each function cold start creates a new Prisma client opening multiple database connections, rapidly exceeding hosted database limits and causing timeout errors like P2024.

How do I fix Prisma connection timeouts on Vercel and AWS Lambda?

Fix Prisma connection timeouts on Vercel and AWS Lambda by enforcing a singleton pattern for the Prisma client, setting a single connection limit per instance, and enabling external pooling services like PgBouncer or Prisma Accelerate.

What is the best way to configure Prisma client connection limits for serverless?

The best way to configure Prisma client connection limits for serverless is setting a low connection_limit parameter per client and enforcing Prisma singleton patterns to keep connection counts within database thresholds.

Does Prisma work with PgBouncer for serverless database connection pooling?

Prisma works with PgBouncer for serverless database connection pooling by mediating connections between serverless functions and the database, preventing direct connection overload and keeping total connections within database limits.

When should I use Prisma Accelerate instead of client-side connection limits?

Use Prisma Accelerate instead of client-side connection limits when external connection mediation between serverless functions and the database is required, as singleton patterns and URL parameter tuning alone may not handle high concurrency on Vercel or AWS Lambda.