high severitySupabase Edge Functions postgres Pool
"remaining connection slots are reserved for non-replication superuser connections" error. pg_stat_activity shows accumulating 'idle' connections after Edge Function calls, quickly exhausting DB limits (e.g., 10 idle after few calls on 60-conn limit).
Root cause
In serverless Edge Functions, each invocation is isolated; creating a new Pool per call keeps idle connections open for reuse within that pool, but since functions scale independently, connections accumulate across invocations until the DB connection limit (e.g., 60 on Micro) is exhausted. pool.release() recycles to the pool but does not close.
supabaseedge-functionspostgrespoolconnection-leakidle-connectionspgbouncer