From 33b3f5a3f3ec00525496e0bba1e450fb4d047c8a Mon Sep 17 00:00:00 2001 From: Brendan Samek Date: Fri, 16 Oct 2026 11:06:08 -0600 Subject: [PATCH] Name each missing Google Sheet variable in the config error The old message abbreviated GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY as _PRIVATE_KEY, which read like a variable name of its own. Co-Authored-By: Claude Opus 5.5 --- src/lib/google-sheet.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/google-sheet.ts b/src/lib/google-sheet.ts index dc77b7c..d40aaf5 100644 --- a/src/lib/google-sheet.ts +++ b/src/lib/google-sheet.ts @@ -44,9 +44,8 @@ export async function upsertSheetRow({ const config = sheetConfig(); if (!config) { if (process.env.NODE_ENV === "production") { - throw new Error( - "GOOGLE_SERVICE_ACCOUNT_EMAIL, _PRIVATE_KEY and GOOGLE_SHEET_ID must be set", - ); + const missing = SHEET_ENV.filter((name) => !process.env[name]); + throw new Error(`Google Sheet not configured. Missing: ${missing.join(", ")}`); } return false; } @@ -121,6 +120,12 @@ export function sheetTimestamp(date = new Date()): string { return `${parts.year}-${parts.month}-${parts.day} ${parts.hour}:${parts.minute}`; } +const SHEET_ENV = [ + "GOOGLE_SERVICE_ACCOUNT_EMAIL", + "GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY", + "GOOGLE_SHEET_ID", +] as const; + type SheetConfig = { clientEmail: string; privateKey: string; sheetId: string }; function sheetConfig(): SheetConfig | null {