You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Supabase Preview Branches, each preview branch has its own database URL. Currently, EDGE_WORKER_DB_URL must be set as a static environment variable, which prevents connecting to the correct preview branch database dynamically.
This is only a problem for preview branches - production/main branch works fine! ✨
What I Want to Do
I want to derive the pooler connection string from SUPABASE_DB_URL (which is already available and branch-aware):
constdirectUrl=Deno.env.get('SUPABASE_DB_URL');constpoolerUrl=directUrl.replace(':5432/',':6543/');EdgeWorker.startFlowWorker(MyFlow,{connectionString: poolerUrl,// ❌ Currently doesn't work});
Why It Doesn't Work
SupabasePlatformAdapter requires EDGE_WORKER_DB_URL as a mandatory environment variable during initialization:
Current workaround: I'm manually setting the env variable after preview creation, but it would be great if this could work automatically. I'd be happy to help with the implementation if needed!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When using Supabase Preview Branches, each preview branch has its own database URL. Currently,
EDGE_WORKER_DB_URLmust be set as a static environment variable, which prevents connecting to the correct preview branch database dynamically.This is only a problem for preview branches - production/main branch works fine! ✨
What I Want to Do
I want to derive the pooler connection string from
SUPABASE_DB_URL(which is already available and branch-aware):Why It Doesn't Work
SupabasePlatformAdapterrequiresEDGE_WORKER_DB_URLas a mandatory environment variable during initialization:Even if I provide
connectionStringin the worker config:context.sqlin handlers uses the env var connection, not the config oneThe Solution I'm Hoping For
Make
EDGE_WORKER_DB_URLoptional whenconnectionStringis provided in config, or auto-derive it fromSUPABASE_DB_URL.Priority:
connectionStringin worker config (explicit override)EDGE_WORKER_DB_URLenv var (backwards compatibility)SUPABASE_DB_URL→ convert:5432/to:6543/This way preview branches can automatically connect to their branch-specific database!
Why This Matters
SUPABASE_DB_URLis already available and branch-aware:5432/→:6543/)Current workaround: Manually set
EDGE_WORKER_DB_URLper branch, which doesn't scale.Related Files
pkgs/edge-worker/src/platform/SupabasePlatformAdapter.ts- Validation logicpkgs/edge-worker/src/EdgeWorker.ts- Worker startuppkgs/edge-worker/src/core/workerConfigTypes.ts- Already documentsconnectionStringoptionCurrent workaround: I'm manually setting the env variable after preview creation, but it would be great if this could work automatically. I'd be happy to help with the implementation if needed!
Thanks! 🙏
Beta Was this translation helpful? Give feedback.
All reactions