Skip to content

The open alternative to Salesforce, designed for AI.

Remove threadId defined assertion as it could not be in messaging sync

Charles Bochet9ebf7a61ab4e
diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/messaging-gmail-fetch-messages-by-batches.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/messaging-gmail-fetch-messages-by-batches.service.ts
index ed45d362256..be2b3e1a142 100644
--- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/messaging-gmail-fetch-messages-by-batches.service.ts
+++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/messaging-gmail-fetch-messages-by-batches.service.ts
@@ -100,7 +100,7 @@ export class MessagingGmailFetchMessagesByBatchesService {
if (!from) {
this.logger.log(
- `From value is missing while importing message in workspace ${workspaceId} and account ${connectedAccountId}`,
+ `From value is missing while importing message #${id} in workspace ${workspaceId} and account ${connectedAccountId}`,
);
return null;
@@ -108,7 +108,7 @@ export class MessagingGmailFetchMessagesByBatchesService {
if (!to && !deliveredTo && !bcc && !cc) {
this.logger.log(
- `To, Delivered-To, Bcc or Cc value is missing while importing message in workspace ${workspaceId} and account ${connectedAccountId}`,
+ `To, Delivered-To, Bcc or Cc value is missing while importing message #${id} in workspace ${workspaceId} and account ${connectedAccountId}`,
);
return null;
@@ -116,7 +116,15 @@ export class MessagingGmailFetchMessagesByBatchesService {
if (!headerMessageId) {
this.logger.log(
- `Header Message ID is missing while importing message in workspace ${workspaceId} and account ${connectedAccountId}`,
+ `Message-ID is missing while importing message #${id} in workspace ${workspaceId} and account ${connectedAccountId}`,
+ );
+
+ return null;
+ }
+
+ if (!threadId) {
+ this.logger.log(
+ `Thread Id is missing while importing message #${id} in workspace ${workspaceId} and account ${connectedAccountId}`,
);
return null;
@@ -190,7 +198,6 @@ export class MessagingGmailFetchMessagesByBatchesService {
const internalDate = message.internalDate;
assert(id, 'ID is missing');
- assert(threadId, 'Thread-ID is missing');
assert(historyId, 'History-ID is missing');
assert(internalDate, 'Internal date is missing');