From aaddac148350edc092675377981098ce63f2771e Mon Sep 17 00:00:00 2001 From: shrouti1507 <60211312+shrouti1507@users.noreply.github.com> Date: Tue, 2 Apr 2024 19:06:13 +0530 Subject: [PATCH] chore: no success should return empty array for linkedin ads (#3238) chore: no success should return empty array --- .../v2/destinations/linkedin_ads/rtWorkflow.yaml | 13 +++++-------- src/cdk/v2/destinations/linkedin_ads/utils.js | 3 +++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cdk/v2/destinations/linkedin_ads/rtWorkflow.yaml b/src/cdk/v2/destinations/linkedin_ads/rtWorkflow.yaml index 8b81790de2..dda322e45e 100644 --- a/src/cdk/v2/destinations/linkedin_ads/rtWorkflow.yaml +++ b/src/cdk/v2/destinations/linkedin_ads/rtWorkflow.yaml @@ -1,6 +1,8 @@ bindings: - path: ./utils - path: ./config + - name: handleRtTfSingleEventError + path: ../../../../v0/util/index steps: - name: validateInput @@ -23,14 +25,9 @@ steps: })[] - name: failedEvents template: | - $.outputs.transform#idx.error.({ - "metadata": ^[idx].metadata[], - "destination": ^[idx].destination, - "batched": false, - "statusCode": .status, - "error": .message, - "statTags": .originalError.statTags - })[] + $.outputs.transform#idx.error.( + $.handleRtTfSingleEventError(^[idx], .originalError ?? ., {}) + )[] - name: batchSuccessfulEvents description: Batches the successfulEvents diff --git a/src/cdk/v2/destinations/linkedin_ads/utils.js b/src/cdk/v2/destinations/linkedin_ads/utils.js index f3f7783962..69fea4299d 100644 --- a/src/cdk/v2/destinations/linkedin_ads/utils.js +++ b/src/cdk/v2/destinations/linkedin_ads/utils.js @@ -162,6 +162,9 @@ const fetchAndVerifyConversionHappenedAt = (message) => { }; function batchResponseBuilder(successfulEvents) { + if (successfulEvents.length === 0) { + return []; + } const constants = { version: successfulEvents[0].message[0].version, type: successfulEvents[0].message[0].type,