SupabaseS
Supabase•11mo ago
kliuksas

Edge function, custom domain and `SUPABASE_URL` env variable

hello 👋

after setting up custom domain, i can call my edge function via that custom domain, but SUPABASE_URL env variable is pointing to the original URL and not to the custom domain.

i'm unable to change SUPABASE_URL env variable, due to error:

$ supabase secrets set SUPABASE_URL="https://api.my-new-domain.com"
Env name cannot start with SUPABASE_, skipping: SUPABASE_URL
Try rerunning the command with --debug to troubleshoot the error.


I'm using edge function to upload files to supabase storage and respond with the uploaded URL with:

const url = supabase.storage.from('my-bucket-name').getPublicUrl('my-file').data.publicUrl


the url is pointing to https://abcdefgh.supabase.co/storage... instead of https://api.my-new-domain.com/storage....

i can fix this on my own by replacing the domain, still would be nice to avoid such juggling.

also posted on GH discussion: https://github.com/orgs/supabase/discussions/13371#discussioncomment-9469267
Was this page helpful?