Skip to content

Commit

Permalink
Merge pull request #37 from openintegrationhub/no-emit-on-missing-sna…
Browse files Browse the repository at this point in the history
…pshot

Trigger will no longer emit objects without a valid snapshot value
  • Loading branch information
SvenHoeffler authored Sep 25, 2024
2 parents d118b54 + 5ea2310 commit f3183ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions templates/lib/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const executeCall = async function (callParams) {
throw new Error(body.error || "API returned erroneous response");
}

this.logger.info("Swagger response %j", { status, url, body, headers });
if (!body){
this.logger.info("Swagger response %j", { status, url, headers });
if (!body) {
this.logger.info("Response body is empty, going to check response data");
const data = await getResponseData.call(this, response);
return { body: data, headers };
Expand Down Expand Up @@ -197,7 +197,9 @@ async function dataAndSnapshot(newElement, snapshot, snapshotKey, standardSnapsh
currentObjectDate = parsedDate;
}
}
if (!snapshot.lastUpdated) {
if (!currentObjectDate && snapshotKey) {
this.logger.info(`Could not find snapshot value for snapshot key ${snapshotKey}, skipping entry...`);
} else if (!snapshot.lastUpdated) {
if (compareDate(currentObjectDate, lastObjectDate)) {
lastObjectDate = currentObjectDate;
}
Expand Down

0 comments on commit f3183ee

Please sign in to comment.