Spaces:
Build error
Build error
| import { createClient, SupabaseClient } from '@supabase/supabase-js'; | |
| const { SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY } = process.env; | |
| if (!SUPABASE_URL) { | |
| throw new Error('SUPABASE_URL is required'); | |
| } | |
| if (!SUPABASE_SERVICE_ROLE_KEY) { | |
| throw new Error('SUPABASE_SERVICE_ROLE_KEY is required'); | |
| } | |
| export const supabase: SupabaseClient = createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, { | |
| auth: { | |
| autoRefreshToken: false, | |
| persistSession: false, | |
| }, | |
| global: { | |
| headers: { | |
| 'X-Client-Info': 'hAPI-face2/1.0.0', | |
| }, | |
| }, | |
| }); | |
| export function tableMissing(error: unknown): boolean { | |
| if (!error || typeof error !== 'object') return false; | |
| if ('code' in error && typeof error.code === 'string') { | |
| return error.code === '42P01'; // Postgres undefined table | |
| } | |
| if ('message' in error && typeof error.message === 'string') { | |
| return error.message.includes('does not exist'); | |
| } | |
| return false; | |
| } | |