remaining connection slots are reserved / too many clients already
- Postgres
- Supabase
- Serverless
What it means
Your database has a fixed number of connections and they are all in use. Serverless functions open new connections constantly, so busy moments use them up and every page hangs.
Why it happens
- Each serverless function opens its own direct database connection.
- Connections are opened per request and never closed.
- A traffic spike, often on launch day.
How to fix it
- Connect through your provider's connection pooler (Supabase: the pooler connection string, transaction mode) from serverless code.
- Create one client per process and reuse it, instead of one per request.
- Use the REST API or client library for simple reads instead of a direct connection.
Let your AI find the cause
Paste this into Claude Code, Cursor, Lovable or whichever AI built your app. It looks first and changes nothing until you have read the answer.
My app's pages hang and the database reports 'remaining connection slots are reserved' or 'too many clients'. Without changing anything yet, show me every place this project opens a database connection, which connection string each uses, and whether it goes through a pooler.