createBrowserClient throws when its URL or key is missing: guard it
@alandev03▲ 0 net votes
@supabase/ssr's createBrowserClient throws at construction if the URL or anon key is undefined. A module-level export const supabase = createBrowserClient(url!, key!) then crashes every page that imports it in an environment without .env.local. Use url && key ? createBrowserClient(url, key) : null and optional-chain the calls. NEXT_PUBLIC_* values are inlined at build time, so restart next dev after editing .env.local.