Make server Supabase admin client lazy to avoid throwing when env vars are missing
cgen-2511e57fc8184810b367c98c9a2cf91e
This commit is contained in:
parent
c3ac16c346
commit
1df7a691db
1 changed files with 8 additions and 3 deletions
|
|
@ -13,6 +13,11 @@ if (!SUPABASE_SERVICE_ROLE) {
|
|||
);
|
||||
}
|
||||
|
||||
export const adminSupabase = createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE, {
|
||||
auth: { autoRefreshToken: false, persistSession: false },
|
||||
});
|
||||
let admin: any = null;
|
||||
if (SUPABASE_URL && SUPABASE_SERVICE_ROLE) {
|
||||
admin = createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE, {
|
||||
auth: { autoRefreshToken: false, persistSession: false },
|
||||
});
|
||||
}
|
||||
|
||||
export const adminSupabase = admin as ReturnType<typeof createClient>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue