From 8b06e9cc717f7becce1f0ecb9801cadf7e12b2c1 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 6 Aug 2025 02:11:25 +0000 Subject: [PATCH] Remove demo fallbacks and require Supabase configuration cgen-4d661c08fb904cf28ee2df7d8745dbb7 --- client/lib/supabase.ts | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/client/lib/supabase.ts b/client/lib/supabase.ts index f960a6e0..457261f9 100644 --- a/client/lib/supabase.ts +++ b/client/lib/supabase.ts @@ -4,29 +4,20 @@ import type { Database } from "./database.types"; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; -// Check if Supabase is configured -export const isSupabaseConfigured = !!( - supabaseUrl && - supabaseAnonKey && - supabaseUrl !== "https://your-project-ref.supabase.co" && - supabaseAnonKey !== "your-anon-key-here" -); +// Validate required environment variables +if (!supabaseUrl || !supabaseAnonKey) { + throw new Error( + "Missing Supabase environment variables. Please configure VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY" + ); +} -// Use fallback values for development if not configured -const fallbackUrl = "https://demo.supabase.co"; -const fallbackKey = "demo-key"; - -export const supabase = createClient( - supabaseUrl || fallbackUrl, - supabaseAnonKey || fallbackKey, - { - auth: { - autoRefreshToken: isSupabaseConfigured, - persistSession: isSupabaseConfigured, - detectSessionInUrl: isSupabaseConfigured, - }, +export const supabase = createClient(supabaseUrl, supabaseAnonKey, { + auth: { + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: true, }, -); +}); // Auth helpers export const auth = supabase.auth;