Skip to content

feat(functions): route edge functions through PgBouncer poolers#7830

Merged
h0lybyte merged 1 commit intodevfrom
trunk/edge-pooler-migration-1773044795
Mar 9, 2026
Merged

feat(functions): route edge functions through PgBouncer poolers#7830
h0lybyte merged 1 commit intodevfrom
trunk/edge-pooler-migration-1773044795

Conversation

@h0lybyte
Copy link
Member

@h0lybyte h0lybyte commented Mar 9, 2026

Summary

Details

Edge Functions primarily use the Supabase SDK via Kong/PostgREST (RPC calls), but the SUPABASE_DB_URL env var is available for direct DB access by the edge runtime. Routing through the pooler:

  • Reduces direct connections to PostgreSQL
  • Enables connection multiplexing for short-lived function invocations
  • The RO URL allows read-heavy routes (feeds, lookups) to use replica poolers

Test plan

  • Verify supabase-shared secret is refreshed with new db-url and db-url-ro keys
  • Confirm Edge Functions pod restarts with the new env vars
  • Test edge function endpoints (meme feed, MC player, health check)
  • Verify no errors in edge function logs related to DB connectivity
  • Check PgBouncer stats: kubectl exec <pooler-pod> -n kilobase -- pgbouncer -d /tmp/pgbouncer.ini -R

Switch SUPABASE_DB_URL from direct supabase-cluster-rw to the
supabase-cluster-pooler-rw (transaction mode, 3 instances).
Add SUPABASE_DB_URL_RO pointing to supabase-cluster-pooler-ro
(session mode, 2 instances) for read-only queries.

Part of #7593 Phase 2 migration.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@h0lybyte h0lybyte merged commit 74f1051 into dev Mar 9, 2026
4 checks passed
@h0lybyte h0lybyte deleted the trunk/edge-pooler-migration-1773044795 branch March 9, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant