Skip to content

Commit

Permalink
fix(Gmail Trigger Node): Early returns in case of no data (#6727)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored Jul 24, 2023
1 parent 1f70f49 commit c2511a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c2511a8

Please sign in to comment.