Skip to content

The open alternative to Salesforce, designed for AI.

fix MailboxConcurrency And email format without @ (#11133)

Guillim96c61df007e5
diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts
index 1356a777385..d04b886cfd5 100644
--- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts
+++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts
@@ -58,14 +58,13 @@ export class CalendarEventImportErrorHandlerService {
break;
case CalendarEventImportDriverExceptionCode.UNKNOWN:
case CalendarEventImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
+ default:
await this.handleUnknownException(
exception,
calendarChannel,
workspaceId,
);
break;
- default:
- throw exception;
}
}
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts
index f13796f483b..388263728b5 100644
--- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts
+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts
@@ -104,6 +104,10 @@ export class MicrosoftGetMessagesService {
),
];
+ const safeParticipantsFormat = participants.filter((participant) => {
+ return participant.handle.includes('@');
+ });
+
return {
externalId: response.id,
subject: response.subject || '',
@@ -116,7 +120,7 @@ export class MicrosoftGetMessagesService {
response.from.emailAddress.address,
connectedAccount,
),
- participants: participants,
+ participants: safeParticipantsFormat,
attachments: [],
};
});
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts
index 0659e2e0231..75ca905fd02 100644
--- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts
+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@nestjs/common';
-import { GraphError } from '@microsoft/microsoft-graph-client';
-
import {
MessageImportDriverException,
MessageImportDriverExceptionCode,
@@ -9,7 +7,7 @@ import {
@Injectable()
export class MicrosoftHandleErrorService {
- public handleMicrosoftMessageFetchError(error: GraphError): void {
+ public handleMicrosoftMessageFetchError(error: any): void {
if (!error.statusCode) {
throw new MessageImportDriverException(
`Microsoft Graph API unknown error: ${error}`,
@@ -32,7 +30,7 @@ export class MicrosoftHandleErrorService {
}
throw new MessageImportDriverException(
- `Microsoft Graph API error: ${error.message}`,
+ `Microsoft driver error: ${error.message}`,
MessageImportDriverExceptionCode.UNKNOWN,
);
}
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts
index 61aa79d7472..0064748dcb9 100644
--- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts
+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts
@@ -57,23 +57,22 @@ export class MessageImportExceptionHandlerService {
workspaceId,
);
break;
- case MessageImportDriverExceptionCode.UNKNOWN:
- case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
- await this.handleUnknownException(
+ case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR:
+ await this.handlePermanentException(
exception,
messageChannel,
workspaceId,
);
break;
- case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR:
- await this.handlePermanentException(
+ case MessageImportDriverExceptionCode.UNKNOWN:
+ case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
+ default:
+ await this.handleUnknownException(
exception,
messageChannel,
workspaceId,
);
break;
- default:
- throw exception;
}
}
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts
index 181a0741e9d..10a156bf7f6 100644
--- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts
+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts
@@ -117,14 +117,6 @@ export class MessagingMessagesImportService {
MESSAGING_GMAIL_USERS_MESSAGES_GET_BATCH_SIZE,
);
- if (connectedAccount.id === '74998005-0180-4d6a-9fa4-fe733c4707f8') {
- this.logger.log(
- '[TMP] Debugging messages import for account:',
- messageChannel.connectedAccount.id,
- );
- this.logger.log('[TMP] messageIdsToFetch:', messageIdsToFetch);
- }
-
if (!messageIdsToFetch?.length) {
await this.messageChannelSyncStatusService.markAsCompletedAndSchedulePartialMessageListFetch(
[messageChannel.id],