Supabase's "Public Environment Variables Prefix" fails

SvelteKit likes public env vars to be prefixed with “PUBLIC_”.

Vercel likes to prefix with “NEXT_PUBLIC_”.

Fortunately, I am provided an option to choose the prefix. However, it has no effect, as illustrated here:

Do you know a fix/workaround/valuable lesson?

Thanks.

This is strange it seems to work as expected for me on a new Supabase install

Can you try updating the configuration and check your console/network tab to see if there’s any errors along the way?

Is this a new supabase integration you’ve just set up? I’ll check with the team to see if there’s multiple “versions” of this page that could explain why it breaks for you but not me

I was able to workaround it by deleting it and recreating.

A few more notes, though:
Initially I already had some PUBLIC_ variables defined that I was fine with being overwritten. When the update failed I figured “strange it failed silently, but it makes sense”. So you might want to try that?

Then I deleted my those problematic env vars and tried again. If I recall correctly, at one point some of the env vars showed up on the list as starting with PUBLIC_ while others showed up as NEXT_PUBLIC_!

Ah thanks for the extra info, I’m not 100% sure if it’s the same issue but I am getting SOME weirdness related to conflicting env vars

  • have prefix set to PUBLIC_WORKAROUND_
  • set environment variable to PUBLIC_CONFLICT_SUPABASE_ANON_KEY
  • change prefix to PUBLIC_CONFLICT_

That SHOULD stop it from renaming because it’s trying to rename my anon key to a variable that already exists, instead I get no error but I see both the old prefix and the new one in the list of envs