The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Stop reporting handled webhook subscription failures to Sentry (#25591)
neo7734c3365782096
diff --git a/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-calendar-notification.handler.ts b/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-calendar-notification.handler.tsindex 95ead2ec600..a752f168c26 100644--- a/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-calendar-notification.handler.ts+++ b/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-calendar-notification.handler.ts@@ -9,6 +9,7 @@ import { type AssertUnreachable } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { In, Repository } from 'typeorm';+import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.type';import { CalendarChannelEntity } from 'src/engine/metadata-modules/calendar-channel/entities/calendar-channel.entity';@@ -31,6 +32,7 @@ export class MicrosoftCalendarNotificationHandler implements WebhookNotificationprivate readonly calendarWebhookSubscriptionService: CalendarWebhookSubscriptionService,private readonly webhookSyncTriggerService: WebhookSyncTriggerService,private readonly metricsService: MetricsService,+ private readonly exceptionHandlerService: ExceptionHandlerService,) {}async handle(notifications: MicrosoftGraphNotification[]): Promise<void> {@@ -99,12 +101,15 @@ export class MicrosoftCalendarNotificationHandler implements WebhookNotificationlifecycleEvent: notification.lifecycleEvent,removedSubscriptionId: notification.subscriptionId,calendarChannel,- }).catch((error) =>+ }).catch((error) => {this.logger.error(`Failed to handle ${notification.lifecycleEvent} lifecycle event for calendar channel ${calendarChannel.id}`,error,- ),- );+ );+ this.exceptionHandlerService.captureExceptions([error], {+ workspace: { id: calendarChannel.workspaceId },+ });+ });continue;}diff --git a/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-messaging-notification.handler.ts b/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-messaging-notification.handler.tsindex 13f0c92a906..3b68d578447 100644--- a/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-messaging-notification.handler.ts+++ b/packages/twenty-server/src/modules/connected-account-sync-webhooks/drivers/microsoft/microsoft-messaging-notification.handler.ts@@ -9,6 +9,7 @@ import { type AssertUnreachable } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { In, Repository } from 'typeorm';+import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.type';import { MessageChannelEntity } from 'src/engine/metadata-modules/message-channel/entities/message-channel.entity';@@ -31,6 +32,7 @@ export class MicrosoftMessagingNotificationHandler implements WebhookNotificatioprivate readonly messagingWebhookSubscriptionService: MessagingWebhookSubscriptionService,private readonly webhookSyncTriggerService: WebhookSyncTriggerService,private readonly metricsService: MetricsService,+ private readonly exceptionHandlerService: ExceptionHandlerService,) {}async handle(notifications: MicrosoftGraphNotification[]): Promise<void> {@@ -98,12 +100,15 @@ export class MicrosoftMessagingNotificationHandler implements WebhookNotificatiolifecycleEvent: notification.lifecycleEvent,removedSubscriptionId: notification.subscriptionId,messageChannel,- }).catch((error) =>+ }).catch((error) => {this.logger.error(`Failed to handle ${notification.lifecycleEvent} lifecycle event for message channel ${messageChannel.id}`,error,- ),- );+ );+ this.exceptionHandlerService.captureExceptions([error], {+ workspace: { id: messageChannel.workspaceId },+ });+ });continue;}diff --git a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/services/webhook-subscription-exception-handler.service.ts b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/services/webhook-subscription-exception-handler.service.tsindex ae018765a48..ec27346885c 100644--- a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/services/webhook-subscription-exception-handler.service.ts+++ b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/services/webhook-subscription-exception-handler.service.ts@@ -2,7 +2,6 @@ import { Injectable } from '@nestjs/common';import { type WebhookSubscriptionChannelType } from 'twenty-shared/types';-import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';import {ConnectedAccountRefreshAccessTokenException,ConnectedAccountRefreshAccessTokenExceptionCode,@@ -27,7 +26,6 @@ type WebhookSubscribableChannelReference = Pick<export class WebhookSubscriptionExceptionHandlerService {constructor(private readonly webhookSubscriptionStatusService: WebhookSubscriptionStatusService,- private readonly exceptionHandlerService: ExceptionHandlerService,) {}public async handleDriverException(@@ -49,11 +47,8 @@ export class WebhookSubscriptionExceptionHandlerService {);case WebhookSubscriptionDriverExceptionCode.INSUFFICIENT_PERMISSIONS:return await this.handleInsufficientPermissionsException(- exception,- operation,channelType,channel,- workspaceId,);case WebhookSubscriptionDriverExceptionCode.TEMPORARY_ERROR:return await this.handleTemporaryException(@@ -80,11 +75,8 @@ export class WebhookSubscriptionExceptionHandlerService {case ConnectedAccountRefreshAccessTokenExceptionCode.REFRESH_TOKEN_NOT_FOUND:case ConnectedAccountRefreshAccessTokenExceptionCode.INVALID_REFRESH_TOKEN:return await this.handleInsufficientPermissionsException(- exception,- operation,channelType,channel,- workspaceId,);case ConnectedAccountRefreshAccessTokenExceptionCode.TEMPORARY_NETWORK_ERROR:return await this.handleTemporaryException(@@ -121,11 +113,8 @@ export class WebhookSubscriptionExceptionHandlerService {): Promise<WebhookSubscriptionRecoveryAction> {if (operation === 'CREATE') {return await this.handleInsufficientPermissionsException(- exception,- operation,channelType,channel,- workspaceId,);}@@ -141,22 +130,9 @@ export class WebhookSubscriptionExceptionHandlerService {}private async handleInsufficientPermissionsException(- exception: unknown,- operation: WebhookSubscriptionOperation,channelType: WebhookSubscriptionChannelType,channel: WebhookSubscribableChannelReference,- workspaceId: string,): Promise<WebhookSubscriptionRecoveryAction> {- this.exceptionHandlerService.captureExceptions([exception], {- additionalData: {- channelId: channel.id,- channelType,- connectedAccountId: channel.connectedAccountId,- operation,- },- workspace: { id: workspaceId },- });-await this.webhookSubscriptionStatusService.markAsExpired(channelType,channel.id,@@ -191,10 +167,6 @@ export class WebhookSubscriptionExceptionHandlerService {channel.id,);- this.exceptionHandlerService.captureExceptions([exception], {- workspace: { id: workspaceId },- });-throw exception;}}