Feature request: let Postgres call its own Edge Functions on every branch, with no hand-copied URLs or keys #51537
Unanswered
icopp
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Supabase's own guides for calling an Edge Function from Postgres (Scheduling Edge Functions, Automatic embeddings) all follow one pattern:
pg_cron→pg_net→ the project URL and a key read from Vault. Every step of that pattern assumes one hand-configured project. With Branching, it breaks down.1. Postgres cannot learn its own API URL
SUPABASE_URLautomatically. Postgres gets nothing, so every guide has you pastehttps://<project-ref>.supabase.cointovault.create_secret(...)by hand (discussion #12813 has asked about this for years).config.tomlor a dotenvx file can name it ahead of time.[remotes.<branch>.db.vault]covers persistent branches only.http://api.supabase.internal:8000, a host the CLI hard-codes and the docs mention only in passing. It differs from theSUPABASE_URLthe local functions see.2. Branching cannot manage a named secret key
@supabase/server'swithSupabase({ auth: 'secret:<name>' })checks for one. That is the right auth for a cron-to-function call.config.tomlcannot declare a named key, so a branch never gets one. Each key has to be created in the dashboard for each project, then copied into env files and Vault by hand. That does not scale past one or two persistent branches.3. Getting a key into Vault means copying it in plaintext
[db.vault]withenv()from an env file someone filled in by hand. There is no way to give Postgres a key the platform already knows.vault.create_secret('<your key>', ...)someone pastes by hand. Followed literally, they put a long-lived key into migration history or the SQL editor log.standard_webhook_*pattern is gone, and nothing with the same zero-config property has replaced it.What we did instead
A migration generates a random token into Vault, the cron job sends it in a header, and the function reads the same Vault entry back with service-role access and compares the two in constant time. That works on every branch with nothing configured, but every project that wants this pattern has to rebuild it from scratch.
Ask
supabase.api_urlsetting or function.config.toml, created per branch and with unique values per branch, and readable from Vault without the value ever appearing in a file.net.invoke_function('name', body)or a Vault entry the platform maintains. Then update the guides to use it instead of pasted URLs and keys.All reactions