From 4c0d0885a3c9e1cd22d825d39943dce8657521d1 Mon Sep 17 00:00:00 2001 From: Aymeric Rabot Date: Thu, 19 Feb 2026 01:45:09 -0500 Subject: [PATCH] fix: declare env vars in turbo.json so Vercel build receives them Turbo was stripping env vars during build on Vercel. Added all required vars to turbo.json build task. Also hardened Supabase and BetterAuth init with fallback placeholders for build-time safety. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/editor/lib/auth.ts | 2 +- apps/editor/lib/supabase/server.ts | 4 ++-- turbo.json | 13 ++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/editor/lib/auth.ts b/apps/editor/lib/auth.ts index 794baa8e..c35bb97f 100644 --- a/apps/editor/lib/auth.ts +++ b/apps/editor/lib/auth.ts @@ -11,7 +11,7 @@ export const auth = createAuth({ db, appName: 'Pascal Editor', baseURL: BASE_URL, - secret: process.env.BETTER_AUTH_SECRET!, + secret: process.env.BETTER_AUTH_SECRET || 'build-placeholder-not-used-at-runtime', googleClientId: process.env.GOOGLE_CLIENT_ID, googleClientSecret: process.env.GOOGLE_CLIENT_SECRET, sendMagicLink: async ({ email, url }) => { diff --git a/apps/editor/lib/supabase/server.ts b/apps/editor/lib/supabase/server.ts index 52e3ff1a..2bdfaa22 100644 --- a/apps/editor/lib/supabase/server.ts +++ b/apps/editor/lib/supabase/server.ts @@ -1,8 +1,8 @@ import { createClient } from '@supabase/supabase-js' import type { SupabaseDatabase } from '@pascal-app/db' -const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL ?? '' -const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY ?? '' +const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co' +const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY || 'placeholder' /** * Supabase client for server-side use with service role key diff --git a/turbo.json b/turbo.json index 8f1ce2f4..3ad80519 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,18 @@ "build": { "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": [".next/**", "!.next/cache/**", "dist/**"] + "outputs": [".next/**", "!.next/cache/**", "dist/**"], + "env": [ + "BETTER_AUTH_SECRET", + "BETTER_AUTH_URL", + "GOOGLE_CLIENT_ID", + "GOOGLE_CLIENT_SECRET", + "RESEND_API_KEY", + "POSTGRES_URL", + "NEXT_PUBLIC_SUPABASE_URL", + "NEXT_PUBLIC_SUPABASE_ANON_KEY", + "SUPABASE_SERVICE_ROLE_KEY" + ] }, "lint": { "dependsOn": ["^lint"]