Hi everyone,
I’m experiencing an annoying issue with my React/Vite application deployed on Netlify. Despite correct configuration, the VITE_SUPABASE_ANON_KEY
environment variable is not injecting its correct value into the final JavaScript bundle, leading to a “Legacy API keys are disabled” error from Supabase.
My Site Name: angusashtonfilmrentals
Deployed URL: https://angusashtonfilmrentals.netlify.app Repo https://github.com/awa750ui/Film-Equipment-Rental-Platform-8782
Problem: My deployed app shows “Error loading equipment: Legacy API keys are disabled”. My src/lib/supabase.js
uses import.meta.env.VITE_SUPABASE_URL
and VITE_SUPABASE_ANON_KEY
.
Browser dev tools show the deployed JavaScript bundle (index-XXXX.js
) uses:
const GE = "sb_publishable_gSdvjxP3Y4gOuRFIKO8XKQ_7j6jTpRy"
This above deployed key is INCORRECT.
The correct, active “Publishable key” set in my Netlify environment variables (and verified in Supabase) is: sb_publishable_g5sdvjxP3YV4gDuRFiKO8XNQ_7j6jTpRy
There’s a clear mismatch between the configured Netlify value and the value embedded in the deployed bundle. No idea why this is happening…
I’ve taken the following steps already to try and fix:
- Confirmed
src/lib/supabase.js
code usesimport.meta.env
(local & GitHub). - Confirmed Netlify environment variable naming (
VITE_SUPABASE_URL
,VITE_SUPABASE_ANON_KEY
). - Repeatedly copied the latest, active “publishable key” from Supa base and pasted it into
VITE_SUPABASE_ANON_KEY
in Netlify. - Consistently used “Clear cache and deploy site” for every deployment.
- Aggressively reset
VITE_SUPABASE_ANON_KEY
(deleted, saved, re-added) in Netlify, then redeployed one billion times ffs. - Supabase confirms
sb_publishable_g5sdvjxP3YV4gDuRFiKO8XNQ_7j6jTpRy
is active and legacy keys are disabled.
Despite all efforts, the incorrect key (sb_publishable_gSdvjxP3Y4gOuRFIKO8XKQ_7j6jTpRy
) is persistently embedded. Does this suggest an issue within Netlify’s build environment or environment variable injection process for my site?
Could you please investigate why the VITE_SUPABASE_ANON_KEY
is not being correctly injected into my Vite build on your platform?
Thanks so much