aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-27 11:19:37 +0000
committerFuwn <[email protected]>2026-03-27 11:19:37 +0000
commit6c5ee63ab50f633e8d743b96b6e0d651903eb119 (patch)
tree0f1141d5e5c3e8292a7a2489bedeff1482a8849b
parentfix(supabase): use dynamic private env for service role (diff)
downloaddue.moe-6c5ee63ab50f633e8d743b96b6e0d651903eb119.tar.xz
due.moe-6c5ee63ab50f633e8d743b96b6e0d651903eb119.zip
fix(ci): fall back to anon key during build analysis
-rw-r--r--src/lib/Database/sb.server.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Database/sb.server.ts b/src/lib/Database/sb.server.ts
index a56957bd..82efe425 100644
--- a/src/lib/Database/sb.server.ts
+++ b/src/lib/Database/sb.server.ts
@@ -1,7 +1,12 @@
import { createClient } from "@supabase/supabase-js";
import { env } from "$env/dynamic/private";
-const sb = createClient(env.SUPABASE_URL, env.SUPABASE_SERVICE_ROLE_KEY, {
+const supabaseUrl = env.SUPABASE_URL;
+const supabaseKey = env.SUPABASE_SERVICE_ROLE_KEY || env.SUPABASE_ANON_KEY;
+
+if (!supabaseUrl || !supabaseKey) throw new Error("Supabase credentials are required.");
+
+const sb = createClient(supabaseUrl, supabaseKey, {
auth: {
autoRefreshToken: false,
persistSession: false,