Skip to content

fix(cli): let edge functions use SUPABASE_DB_URL under supabase start (CLI-3375) - #7950

Queued
7ttp wants to merge 3 commits into
developfrom
7ttp/cli-3375-edge-functions-cant-connect-with
Queued

7ttp wants to merge 3 commits into
developfrom
7ttp/cli-3375-edge-functions-cant-connect-with

Conversation

@7ttp

@7ttp 7ttp commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

TL;DR

fixes edge functions failing to reach the database through SUPABASE_DB_URL under supabase start

what hurts the user?

supabase start gave functions a SUPABASE_DB_URL on host supabase_db_<project> and the edge runtime's node:dns rejects the underscore, so Postgres.js or Drizzle failed with getaddrinfo ENOTFOUND

fixed by:

giving the db container a project alias without underscores (db-<project id>) and using it as the host, so functions reach their own database even when stacks share a --network-id, and a running stack picks it up on its next supabase stop and supabase start

ref:

@7ttp 7ttp self-assigned this Dec 3, 2026
@7ttp
7ttp requested a review from a team as a code owner December 3, 2026 21:28
@7ttp
7ttp requested a review from kanadgupta December 3, 2026 21:28
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit f8ff356 against develop at 8329f43 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 210 ms 227 ms no real change (+8%, within normal variation)
supabase --help help 290 ms 249 ms no real change (-14%, within normal variation)
supabase init init 319 ms 295 ms no real change (-7%, within normal variation)
supabase migration new bench migration-new 219 ms 240 ms no real change (+10%, within normal variation)
supabase config convert config-convert 227 ms 232 ms no real change
supabase config validate config-validate 209 ms 236 ms no real change (+13%, within normal variation)
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 318 ms 289 ms no real change (-9%, within normal variation)
supabase projects list projects-list 213 ms 188 ms no real change (-12%, within normal variation)
supabase functions list --project-ref replayfixtureprojref functions-list 255 ms 243 ms no real change

API calls: unchanged for all 9 commands.

Binary size: 134.1 MB, unchanged.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 142-314 ms 181-317 ms +17 ms (+8%) within noise
supabase --help help 176-324 ms 201-322 ms -40 ms (-14%) within noise
supabase init init 240-423 ms 248-431 ms -23 ms (-7%) within noise
supabase migration new bench migration-new 204-330 ms 155-387 ms +21 ms (+10%) within noise
supabase config convert config-convert 179-287 ms 201-258 ms +6 ms (+2%) within noise
supabase config validate config-validate 162-292 ms 182-272 ms +28 ms (+13%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 224-389 ms 228-442 ms -29 ms (-9%) within noise
supabase projects list projects-list 170-280 ms 172-227 ms -25 ms (-12%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 211-313 ms 193-351 ms -12 ms (-5%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase config validate config-validate 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@b0254cf supplied to reviewers (advisory, not a style pass).

Both independent reviews completed. The PR switches Edge Runtime’s SUPABASE_DB_URL to the db alias and preserves password encoding. One minor correctness finding is confirmed by code inspection. Projects that share a Docker network can resolve db to the wrong Postgres container. The diff changes no CLI reference prose, and the affected overlays make no claim about this hostname.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/start/services/edge-runtime.service.ts:112 correctness claude When two projects share a Docker network through --network-id or SUPABASE_NETWORK_ID, both Postgres containers register the db alias. The new SUPABASE_DB_URL can resolve to either container, so an Edge Function can connect to the other project’s database if its credentials match.

Stats

Claude findings: 1 · Codex findings: 0 · Confirmed: 1 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down. Switching to a hostname without an underscore is the right fix for node:dns. One isolation issue with the specific alias, plus a test suggestion.

@7ttp
7ttp requested a review from jgoux December 4, 2026 12:09

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both earlier points are addressed: the project-specific db-<id> alias is used for SUPABASE_DB_URL, and the contract echo function now resolves the host through node:dns. One low-priority note inline.

@7ttp
7ttp added this pull request to the merge queue Dec 4, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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.

Edge runtime container lookup fails due to non-DNS-compliant container names

2 participants