Description
In src/libs/supabase/supabase-middleware-client.ts, the getEnvVar() call for the anon key passes the wrong label:
getEnvVar(process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, 'NEXT_PUBLIC_SUPABASE_URL'),
The second argument should be 'NEXT_PUBLIC_SUPABASE_ANON_KEY', not 'NEXT_PUBLIC_SUPABASE_URL'.
Impact
If NEXT_PUBLIC_SUPABASE_ANON_KEY is not set, the thrown error says:
Reference to undefined env var: NEXT_PUBLIC_SUPABASE_URL
This sends developers debugging the wrong variable. Especially confusing since NEXT_PUBLIC_SUPABASE_URL might already be correctly set.
Fix
getEnvVar(process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, 'NEXT_PUBLIC_SUPABASE_ANON_KEY'),
One-line change.
Description
In
src/libs/supabase/supabase-middleware-client.ts, thegetEnvVar()call for the anon key passes the wrong label:The second argument should be
'NEXT_PUBLIC_SUPABASE_ANON_KEY', not'NEXT_PUBLIC_SUPABASE_URL'.Impact
If
NEXT_PUBLIC_SUPABASE_ANON_KEYis not set, the thrown error says:This sends developers debugging the wrong variable. Especially confusing since
NEXT_PUBLIC_SUPABASE_URLmight already be correctly set.Fix
One-line change.