vetkit.resilience.db-client-per-request.js-handler
$CLIENT is created inside a request handler. Every request then opens its own database connections (or a whole pool) and pays for the handshake and authentication, and under load the connections pile up until the database refuses new ones.
Last updated:
Suite: Production readiness
javascript, typescript
$CLIENT is created inside a request handler. Every request then opens its own database connections (or a whole pool) and pays for the handshake and authentication, and under load the connections pile up until the database refuses new ones.
Category: RESILIENCE · Engine rule severity: WARNING
How to fix it
Create the client or pool once per process, in a module that exports it (for Next.js, the globalThis.prisma ??= new PrismaClient() singleton survives hot reloads), and import it in handlers. Take connections from the shared pool (pool.query, pool.connect() + release()) instead of opening new clients.
References
Source: packages/engine/rules/resilience/javascript.yml.
Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.