more logging to look at calendar errors (#11603)

Adding more logs to look at calendar errors that we have currently

Should help investigation on
https://twenty-v7.sentry.io/issues/5182547220/events/7e8b168887384ede8397e79c15adeb50/?project=4507072499810304
This commit is contained in:
Guillim
2025-04-16 11:46:02 +02:00
committed by GitHub
parent b7cfe89b14
commit db8a60fe6f
2 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { Injectable } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { GaxiosError } from 'gaxios'; import { GaxiosError } from 'gaxios';
import { calendar_v3 as calendarV3 } from 'googleapis'; import { calendar_v3 as calendarV3 } from 'googleapis';
@ -12,6 +12,8 @@ import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/s
@Injectable() @Injectable()
export class GoogleCalendarGetEventsService { export class GoogleCalendarGetEventsService {
private readonly logger = new Logger(GoogleCalendarGetEventsService.name);
constructor( constructor(
private readonly googleCalendarClientProvider: GoogleCalendarClientProvider, private readonly googleCalendarClientProvider: GoogleCalendarClientProvider,
) {} ) {}
@ -92,6 +94,10 @@ export class GoogleCalendarGetEventsService {
throw parseGaxiosError(error); throw parseGaxiosError(error);
} }
if (error.response?.status !== 410) { if (error.response?.status !== 410) {
this.logger.error(
`Calendar event import error for Google Calendar. status: ${error.response?.status}`,
);
this.logger.log(error);
const googleCalendarError = { const googleCalendarError = {
code: error.response?.status, code: error.response?.status,
reason: reason:

View File

@ -1,4 +1,4 @@
import { Injectable } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator';
import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service'; import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service';
@ -23,6 +23,7 @@ import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/s
@Injectable() @Injectable()
export class CalendarFetchEventsService { export class CalendarFetchEventsService {
private readonly logger = new Logger(CalendarFetchEventsService.name);
constructor( constructor(
@InjectCacheStorage(CacheStorageNamespace.ModuleCalendar) @InjectCacheStorage(CacheStorageNamespace.ModuleCalendar)
private readonly cacheStorage: CacheStorageService, private readonly cacheStorage: CacheStorageService,
@ -118,6 +119,10 @@ export class CalendarFetchEventsService {
); );
} }
} catch (error) { } catch (error) {
this.logger.log(
`Calendar event fetch error for workspace ${workspaceId} and calendar channel ${calendarChannel.id}`,
);
this.logger.error(error);
await this.calendarEventImportErrorHandlerService.handleDriverException( await this.calendarEventImportErrorHandlerService.handleDriverException(
error, error,
syncStep, syncStep,