import { createClient } from '@supabase/supabase-js'; const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; if (!supabaseUrl || !supabaseAnonKey) { console.warn('Missing Supabase environment variables. Double check your .env file.'); } // Safe initialization to prevent app crash if keys are missing // We use a placeholder if the real keys are missing, so the app still loads. // The auth calls will fail with a clear network error instead of a whitespace crash. const url = supabaseUrl && supabaseUrl.length > 0 ? supabaseUrl : 'https://placeholder.supabase.co'; const key = supabaseAnonKey && supabaseAnonKey.length > 0 ? supabaseAnonKey : 'placeholder'; console.log('Supabase Config:', { url: url === 'https://placeholder.supabase.co' ? 'USING PLACEHOLDER' : url, keyLength: key.length, keyExists: key !== 'placeholder' }); export const supabase = createClient(url, key);