Skip to content

fix(stack): pass [edge_runtime.secrets] to functions like legacy (CLI-2577) - #7481

Merged
7ttp merged 2 commits into
developfrom
7ttp/cli-2577-stack-match-legacy-functions-environment-for-start-and
Nov 4, 2026
Merged

7ttp merged 2 commits into
developfrom
7ttp/cli-2577-stack-match-legacy-functions-environment-for-start-and

Conversation

@7ttp

@7ttp 7ttp commented Nov 4, 2026

Copy link
Copy Markdown
Member

TL;DR

fixes functions on the stack getting [edge_runtime.secrets] exactly as written in config.toml, so they now see the same secrets as on the legacy backend

whats missing?

on the stack, supabase start and supabase functions serve passed [edge_runtime.secrets] to functions untouched

a secret written as my_key stayed lowercase, so Deno.env.get("MY_KEY") came back empty

an env(NAME) pointing at an unset variable arrived as the text env(NAME), and empty secrets arrived as empty strings

fixed now by:

the stack now runs secrets through the same step the legacy backend uses, so names are uppercased and empty or unset values are skipped

secrets starting with SUPABASE_ are skipped too, same as on the legacy backend

ref:

@7ttp 7ttp self-assigned this Nov 4, 2026
@7ttp
7ttp requested a review from a team as a code owner November 4, 2026 07:31
@7ttp
7ttp requested a review from kanadgupta November 4, 2026 07:31
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit c6f3ae1 against develop at c94ecf3 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 155 ms 154 ms no real change
supabase --help help 155 ms 152 ms no real change
supabase init init 151 ms 156 ms no real change
supabase migration new bench migration-new 167 ms 164 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 198 ms 201 ms no real change
supabase projects list projects-list 187 ms 194 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 177 ms 183 ms no real change

API calls: unchanged for all 7 commands.

Binary size: 134.1 MB, down 4.0 KB from 134.1 MB.

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

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 147-180 ms 147-182 ms -1 ms (-1%) within noise
supabase --help help 147-166 ms 148-165 ms -3 ms (-2%) within noise
supabase init init 149-238 ms 149-184 ms +5 ms (+3%) within noise
supabase migration new bench migration-new 157-192 ms 155-186 ms -3 ms (-2%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 181-300 ms 186-249 ms +3 ms (+1%) within noise
supabase projects list projects-list 173-219 ms 173-238 ms +7 ms (+4%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 169-205 ms 169-206 ms +7 ms (+4%) 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 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

Both independent reviews reported no findings. Reading the changed code and surrounding resolution, decryption, and service configuration paths revealed no additional actionable issues. The shared helper preserves legacy serve behavior and applies it to stack secrets. Tests were not run because dependencies are not installed.

Findings

No issues found.

Stats

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


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

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

@7ttp 7ttp changed the title fix(cli): match legacy [edge_runtime.secrets] env on the stack (CLI-2577) fix(stack): pass [edge_runtime.secrets] to functions like legacy (CLI-2577) Nov 4, 2026
@7ttp
7ttp enabled auto-merge November 4, 2026 09:56
@7ttp
7ttp added this pull request to the merge queue Nov 4, 2026
Merged via the queue into develop with commit 47a0f63 Nov 4, 2026
49 checks passed
@7ttp
7ttp deleted the 7ttp/cli-2577-stack-match-legacy-functions-environment-for-start-and branch November 4, 2026 10:04
kallebysantos pushed a commit to kallebysantos/supabase-cli that referenced this pull request Nov 5, 2026
…77) (supabase#7499)

## TL;DR

fixes the stack's Functions env so `supabase start` and `supabase
functions serve` give functions the same env as the legacy backend

## whats missing?

stack `functions serve` ignored each function's own
`supabase/functions/<slug>/.env`
the stack let `[edge_runtime.secrets]` win over
`supabase/functions/.env`, while legacy lets the file win

on a running stack `--env-file` kept the `functions/.env` values, and
`.env` edits only applied after a restart
multiline values like PEM keys were rejected

`--debug` printed less than legacy and the serve banner showed the
internal port
a stack where only Realtime serves the API failed with `Shared API port
differs from existing claim`

## fixed now by:

legacy and the stack now share one env resolver, and legacy `start` and
`functions serve` output stays exactly the same

stack `functions serve` reads each function's `.env`, re-reads env files
on every run and restores the saved config on exit
multiline values travel in the Functions config on native and docker

Realtime counts as an API source, and the runtime now gets the API port
and debug mode

## ref:

- missed in: supabase#6684
- extends: supabase#7481
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