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 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-03-03 15:05:20 +01:00
parent 3909f23725
commit ab6728c2d5
+7
View File
@@ -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) {