prisma-connection-pool-exhaustion

Configure Prisma connection pooling for serverless Node.js deployments.

1|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/Hankanman/claude-config --skill prisma-connection-pool-exhaustion-hankanman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-connection-pool-exhaustion
Source: https://github.com/Hankanman/claude-config/tree/main/config/skills/claudeception/examples/prisma-connection-pool-exhaustion
Command: npx skills add https://github.com/Hankanman/claude-config --skill prisma-connection-pool-exhaustion-hankanman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Serverless deployments spawn new Prisma clients per cold start, which opens several database connections and can exhaust the database's connection pool, causing timeouts and degraded performance.

Core Features & Use Cases

  • Connection pooling with PgBouncer or Prisma Accelerate to cap concurrent connections.
  • Provider-specific guidance for managed databases (Supabase, Neon) and how to enable pooling.
  • PrismaClient singleton pattern to avoid creating new clients on every invocation.

Quick Start

  • Update your DATABASE_URL to use a pooled connection string when supported (e.g., Supabase: postgresql://...:6543/...?pgbouncer=true).
  • Limit connections in Prisma by configuring the datasource and optional URL parameters, e.g., append ?connection_limit=1 to the DATABASE_URL.
  • Implement a PrismaClient singleton in your codebase (development and production) to survive hot reloads and cold starts.
  • Verify with a load test and monitor database connections to ensure they stay within limits.

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 exhaust database connections in serverless deployments?

Serverless platforms like AWS Lambda spawn new Prisma clients per cold start, which opens multiple database connections and exhausts the connection pool, causing P2024 errors and timeouts.

How do I fix Prisma P2024 errors on Vercel or AWS Lambda?

Fix P2024 errors by using a pooled connection string with PgBouncer, appending connection_limit=1 to your datasource URL, and implementing a PrismaClient singleton to prevent new clients per invocation.

Do I need a PgBouncer connection pooler for Prisma with Supabase or Neon?

Managed PostgreSQL providers like Supabase and Neon require a connection pooler like PgBouncer to cap concurrent connections and prevent Prisma pool exhaustion in serverless Node.js environments.

How do I configure a PrismaClient singleton for Node.js serverless functions?

Implement a PrismaClient singleton by assigning the client to a global variable outside the serverless function handler, preventing new client instantiation during hot reloads and cold starts.

What is the best way to limit Prisma database connections in serverless apps?

The best way to limit connections is combining a PgBouncer pooled datasource URL with connection_limit=1 parameters and a PrismaClient singleton to effectively cap concurrent database connections.

Does Prisma connection pooling work with MySQL serverless deployments?

Prisma connection pooling works with MySQL serverless deployments by configuring datasource URL connection limits and implementing a PrismaClient singleton to prevent pool exhaustion on platforms like Netlify Functions.