Skip to content

Branching: git-triggered branch-action redeploys edge functions without custom secrets in their environment #51535

Open

Description

@jason-merrell

Bug report

Describe the bug
On a preview branch associated with a git branch, every push triggers the platform's branch-action sync. When that sync redeploys an edge function, the new deployment starts without the project's custom edge-function secrets in its environment, even though supabase secrets list still shows them. The platform-managed SUPABASE_* secrets are present; only user-set secrets are missing.

Re-running supabase secrets set (without a deploy) does not fix it: the running function's environment is fixed at deploy time. Only a manual supabase functions deploy restores the secret.

This silently disables any security check that depends on a custom secret. Our case is a Custom Access Token auth hook that verifies GoTrue's webhook signature with a secret held as an edge-function secret. After a platform redeploy, verification quietly stops enforcing, because the function sees no secret and fails open. With fail-closed verification, every login on the branch would break instead.

To reproduce

  1. Create a preview branch associated with a git branch (supabase branches create <name> --git-branch <branch>).
  2. Set a custom secret on the branch: supabase secrets set MY_SECRET=… --project-ref <branch-ref>.
  3. Deploy an edge function that reads Deno.env.get("MY_SECRET") and reports whether it is set. Observe it is set.
  4. Push a commit to the git branch that changes that function's source.
  5. About 30–60 s later the branch-action workflow runs and redeploys the function, which bumps its version.
  6. Call the function again. MY_SECRET is now unset, while supabase secrets list still lists it.

Observed

Function version Deployed by Custom secret visible to the function
v7 manual deploy, secret already set yes
v10 manual deploy (secret set, then deploy) yes
v11 branch-action sync after a push no
  • Across 5 observed pushes, the sync ran 29–56 s after the push. It redeployed the function only when the function's source differed.
  • At the second of the v11 redeploy, every platform SUPABASE_* secret on the branch was re-written. The custom secret's updated_at in secrets list did not change.
  • supabase secrets set alone, followed by three probes, did not restore it.

Expected behavior
A platform-initiated redeploy should start the function with the same environment a user-initiated deploy gets, including custom secrets. Alternatively, the docs should state that branch syncs drop custom secrets.

Related (minor)
The current CLI accepts and silently ignores a secret name it rejects during supabase secrets set. It reports success and stores nothing, rather than returning an error.

System information

  • Supabase CLI 2.113.0
  • Hosted project with Branching enabled (GitHub integration), preview branch with a git-branch association

Activity

  1. added
    external-issue
    on Oct 11, 2026
  2. added
    branching
    and removed on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    branchingexternal-issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions