Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createClient } from '@supabase/supabase-js';
import type { Database } from './database.types';

const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://placeholder.supabase.co';
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || 'placeholder';

if (!supabaseUrl || !supabaseAnonKey) {
throw new Error('Missing Supabase environment variables');
if (!import.meta.env.VITE_SUPABASE_URL || !import.meta.env.VITE_SUPABASE_ANON_KEY) {
console.warn('Missing Supabase environment variables. Using placeholder values.');
}

export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey);
Comment on lines +4 to 11

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using hard-coded placeholder values means the app will still create a Supabase client and attempt real network calls (e.g., in App.tsx on startup) against https://placeholder.supabase.co with a bogus key. This can cause confusing runtime failures, slow startup, and can unintentionally send requests to an external domain when the app is misconfigured. Safer pattern: only create/export a real client when both env vars are present; otherwise export null/undefined (or a stub that throws on use) plus an isSupabaseConfigured flag so callers can skip data loading and show a configuration error screen.

Copilot uses AI. Check for mistakes.
Loading