Skip to content

Commit 8a22f85

Browse files
committed
Fix Vercel deployment: don't throw error on missing env vars, allow graceful degradation
1 parent a36dd01 commit 8a22f85

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/lib/supabase.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import { createClient } from '@supabase/supabase-js';
33
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
44
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
55

6+
// Log for debugging
7+
console.log('Supabase URL:', supabaseUrl ? 'Set' : 'Missing');
8+
console.log('Supabase Key:', supabaseAnonKey ? 'Set' : 'Missing');
9+
610
if (!supabaseUrl || !supabaseAnonKey) {
7-
throw new Error('Missing Supabase environment variables');
11+
console.error('Missing Supabase environment variables');
12+
console.error('VITE_SUPABASE_URL:', supabaseUrl);
13+
console.error('VITE_SUPABASE_ANON_KEY:', supabaseAnonKey);
814
}
915

10-
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
16+
export const supabase = createClient(supabaseUrl || '', supabaseAnonKey || '', {
1117
auth: {
1218
autoRefreshToken: true,
1319
persistSession: true,

vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ import path from "path";
55

66
export default defineConfig(({ mode }) => ({
77
base: mode === 'production' ? '/' : '/bb84_simulation/',
8+
build: {
9+
outDir: 'dist',
10+
sourcemap: false,
11+
rollupOptions: {
12+
output: {
13+
manualChunks: undefined
14+
}
15+
}
16+
},
817
server: {
918
host: "::",
1019
port: 8080,

0 commit comments

Comments
 (0)