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:
I'm using edge function to upload files to supabase storage and respond with the uploaded URL with:
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-94692674 Replies
You cannot set any
SUPABASE_
prefixed env variables as they are setup by default https://supabase.com/docs/guides/functions/secrets#default-secrets.thanks for reply! yes, i realize that from the error message.
does it mean, SUPABASE_URL in edge function is always hard-set to the original supabase project URL (the one before setting up custom domain)?
if that's correct, then i'll do a
publicFileUrl.replace(Deno.env.get('SUPABASE_URL'), 'https://api.my-new-domain.com')
.
i was assuming that SUPABASE_URL
env var automatically points to custom domain once that gets set up.I don't see anything in the docs explaining what it should be when using custom domains. I personally don't use custom domains. Maybe open an issue on the edge-runtime Github repo to see what those working on the code says it should be.
i was assuming that SUPABASE_URL env var automatically points to custom domain once that gets set up.From reading the custom domain docs I would have thought this too.
for future searchers: in the end i'm just manually replacing
SUPABASE_URL
with my custom domain: