Skip to content

fix(stack): resolve functions env like legacy start and serve (CLI-2577) - #7499

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

7ttp merged 6 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 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:

@7ttp 7ttp self-assigned this Nov 4, 2026
@7ttp
7ttp requested a review from a team as a code owner November 4, 2026 17:55
@7ttp
7ttp requested a review from Prashansa-K November 4, 2026 17:55
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit 84d3acf against develop at 4d88c8b · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 357 ms 311 ms no real change (-13%, within normal variation)
supabase --help help 292 ms 287 ms no real change
supabase init init 322 ms 343 ms no real change (+7%, within normal variation)
supabase migration new bench migration-new 318 ms 382 ms no real change (+20%, within normal variation)
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 397 ms 434 ms no real change (+9%, within normal variation)
supabase projects list projects-list 352 ms 326 ms no real change (-8%, within normal variation)
supabase functions list --project-ref replayfixtureprojref functions-list 236 ms 251 ms no real change (+6%, within normal variation)

API calls: unchanged for all 7 commands.

Binary size: 134.6 MB, up 4.0 KB from 134.6 MB.

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

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 245-428 ms 245-433 ms -47 ms (-13%) within noise
supabase --help help 260-382 ms 241-370 ms -5 ms (-2%) within noise
supabase init init 285-381 ms 283-388 ms +21 ms (+7%) within noise
supabase migration new bench migration-new 229-512 ms 296-497 ms +64 ms (+20%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 256-470 ms 391-619 ms +37 ms (+9%) within noise
supabase projects list projects-list 274-424 ms 245-486 ms -26 ms (-8%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 210-439 ms 219-408 ms +15 ms (+6%) 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[bot]

This comment was marked as resolved.

@7ttp
7ttp requested a review from jgoux November 4, 2026 18:41

@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.

Env precedence, the $default env merge, the host port and debug wiring all match the legacy path. Two small follow-ups inline.

@7ttp
7ttp added this pull request to the merge queue Nov 5, 2026
Merged via the queue into develop with commit e52b729 Nov 5, 2026
57 checks passed
@7ttp
7ttp deleted the 7ttp/cli-2577-stack-match-legacy-functions-environment-for-start-and branch November 5, 2026 08:28
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