# Fix “too many connections” errors

> The database refuses connections under light traffic on a serverless host.

Web page: https://buildladder.com/resources/prompts/too-many-connections

What you get: One shared connection setup that goes through a pooler, sized for your plan.

Paste it into: Your AI tool, in your project

## Prompt to copy

```text
My app sometimes fails with "too many connections" or connection timeouts, even with little traffic.

Find every place the code creates a database client or connection. Tell me whether a new one is made per request or per function instance, and whether the connection string goes straight to the database or through a pooler. Check the connection limit on my database plan and how my host runs the code. Serverless functions open many short-lived connections.

Fix it so the app reuses one client per instance and connects through the pooler in production, with a sensible pool size. Show me which environment variable changes and how to confirm the connection count afterwards.
```
