Skip to content

fix: recognize Supabase edge runtime via SB_EXECUTION_ID - #153

Merged
mandarini merged 2 commits into
mainfrom
fix/edge-functions-detection
Sep 9, 2026
Merged

mandarini merged 2 commits into
mainfrom
fix/edge-functions-detection

Conversation

@mandarini

@mandarini mandarini commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Inside Supabase's edge runtime, isEdgeFunctions() returned false unless the gateway injected SUPABASE_FUNCTION_SLUG: std-env classifies the runtime as edge-light (it exposes an EdgeRuntime global) rather than deno, so on a CLI older than cli#6345 every zero-config withOAuthProtectedResource() request failed with MISSING_RESOURCE_SERVER as a raw 500. isEdgeFunctions() now also returns true when SB_EXECUTION_ID is set, which the edge runtime injects into every worker, hosted and local, so detection no longer depends on the CLI version. Adds unit tests for the predicate (slug set, SB_EXECUTION_ID under edge-light, plain Deno, Node, and a real edge-light host staying false) and documents the marker in the environment variables and error handling docs.

Fixes SDK-1768.

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@153

commit: c424804

@mandarini mandarini self-assigned this Sep 9, 2026
@mandarini
mandarini marked this pull request as ready for review September 9, 2026 12:05
@mandarini
mandarini requested review from a team as code owners September 9, 2026 12:05
@mandarini
mandarini merged commit 11b02f3 into main Sep 9, 2026
10 checks passed
@mandarini
mandarini deleted the fix/edge-functions-detection branch September 9, 2026 12:09
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.

2 participants