From ab6728c2d50ac6651291ef64780e596df4de8c71 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Tue, 3 Mar 2026 15:05:20 +0100 Subject: [PATCH] fix: skip env validation during Docker builds with placeholder vars The ensureInitialized() env check threw on missing SUPABASE_SERVICE_ROLE_KEY and CRON_SECRET during Next.js page collection at Docker build time. These server-only vars are injected at runtime, not build time. Co-Authored-By: Claude Opus 4.6 --- lib/init.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/init.ts b/lib/init.ts index 7643999b..c2227513 100644 --- a/lib/init.ts +++ b/lib/init.ts @@ -30,6 +30,13 @@ const OPTIONAL_VARS = [ ] as const function validateEnvironment(): void { + // During Docker builds, NEXT_PUBLIC_* vars are placeholder sentinels + // replaced at runtime by docker-entrypoint.sh. Server-only vars like + // SUPABASE_SERVICE_ROLE_KEY are not available at build time at all. + // Skip validation so Next.js page collection doesn't fail. + const isBuildPlaceholder = process.env.NEXT_PUBLIC_SUPABASE_URL?.startsWith('__') + if (isBuildPlaceholder) return + const missing: string[] = [] for (const v of REQUIRED_CORE_VARS) {