Skip to content

Supabase databaseSupabase: too many connections, or remaining connection slots are reserved

Requests start failing with “remaining connection slots are reserved for non-replication superuser connections” or “too many connections”. It often shows up as traffic grows, and serverless functions are a common cause. Here’s why, in Supabase’s own words, and the settings that fix it, or hand it over at a fixed price.

Short answer

Your database has a connection limit set by its compute size, and something is opening more connections than it allows. In serverless or edge functions, connect through Supabase’s shared pooler in transaction mode, create the client once, and set its pool to 1 connection. If you’re already pooling and still at the limit, a larger compute size allows more connections.

Why the connections run out, and the fix

  1. 01

    The database is at its connection limit

    “This error usually occurs when the database reaches the maximum number of connections allowed based on the compute add-on.” Supabase, Remaining connection slots are reserved

    Each compute size allows a set number of connections. Check how many are in use in the dashboard before changing anything, so you know whether the fix is fewer connections or a bigger instance.

  2. 02

    Serverless functions connect directly

    “Use it for serverless and edge functions, which open many short-lived connections.” Supabase, Connect to your database

    Each warm instance of a function on Vercel, Netlify or Supabase Edge Functions can hold its own connections. Use the transaction pooler connection string from the Connect dialog instead of the direct one.

  3. 03

    The client library opens too many per instance

    “Library defaults are too high for serverless. Postgres.js defaults to 10 connections.” Supabase, Connect to your database

    A database library keeps its own pool. Create the client once, outside the request handler, set its pool to 1 connection in serverless code, and turn off prepared statements, which the shared pooler doesn’t support in transaction mode. With Prisma, the matching setting is connection_limit.

Checked against the vendor’s docs on : Supabase docs: Connect to your database; Supabase: Remaining connection slots are reserved.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Vercel function timeout (504) · Supabase project paused · Backend and API development

Questions

More on this error

Do I need to upgrade my Supabase plan?

Not first. Supabase suggests reducing connections and using pooling, and upgrading the compute size only if you’re already pooling and still at the limit.

Does the Supabase JavaScript client use database connections?

The supabase-js client talks to Supabase’s APIs over HTTP, not straight to Postgres. The connection limit is usually reached by code that connects to Postgres directly, such as an ORM or a Postgres driver in a server or function.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; we reply by email, usually within one business day.