Fix build error by making Google Calendar JSON non-critical

- Don't throw error if GOOGLE_SERVICE_ACCOUNT_JSON is invalid
- Just warn and continue with Google Calendar disabled
- Allow build to complete even if Google Calendar config is wrong
- Prevent 'Failed to collect page data' build error

Fixes Coolify deployment issue
This commit is contained in:
Marco Gallegos
2026-01-18 10:41:47 -06:00
parent 02b933d893
commit 0ef3d19f08

View File

@@ -53,11 +53,13 @@ class GoogleCalendarService {
} catch (jsonError) {
console.error('GoogleCalendar: Failed to parse GOOGLE_SERVICE_ACCOUNT_JSON', jsonError);
console.error('GoogleCalendar: Service account JSON value:', serviceAccountJson);
throw new Error('Invalid GOOGLE_SERVICE_ACCOUNT_JSON format. Please check environment variable.');
// Don't throw error - just warn and continue with Google Calendar disabled
return;
}
if (!credentials.type || !credentials.project_id || !credentials.private_key) {
throw new Error('Invalid GOOGLE_SERVICE_ACCOUNT_JSON: Missing required fields');
console.warn('GoogleCalendar: Invalid GOOGLE_SERVICE_ACCOUNT_JSON - missing required fields. Calendar sync disabled.');
return;
}
const auth = new google.auth.GoogleAuth({
@@ -72,7 +74,8 @@ class GoogleCalendarService {
console.log('GoogleCalendar: Service initialized successfully');
} catch (error) {
console.error('GoogleCalendar: Initialization failed', error);
throw error;
// Don't throw - just warn to allow build to continue
console.warn('GoogleCalendar: Continuing with Google Calendar disabled');
}
}