diff --git a/packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.ts b/packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.ts index 83c89147fc..40b1f28484 100644 --- a/packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.ts +++ b/packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.ts @@ -257,8 +257,9 @@ export class GmailTrigger implements INodeType { ); responseData = responseData.messages; - if (responseData === undefined) { - responseData = []; + if (!responseData?.length) { + webhookData.lastTimeChecked = endDate; + return null; } const simple = this.getNodeParameter('simple') as boolean; @@ -312,6 +313,11 @@ export class GmailTrigger implements INodeType { ); } + if (!responseData?.length) { + webhookData.lastTimeChecked = endDate; + return null; + } + const getEmailDateAsSeconds = (email: IDataObject) => { const { internalDate, date } = email; return internalDate