From 2d8b315a5f2e681bc256128032e4ee066f9177fc Mon Sep 17 00:00:00 2001 From: Gauravudia <60897972+Gauravudia@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:37:30 +0530 Subject: [PATCH 1/2] fix: handle trade desk null, undefined fields (#3661) --- .../the_trade_desk/transformRecord.js | 13 ++- .../the_trade_desk/router/data.ts | 84 ++++++++++++++++++- 2 files changed, 92 insertions(+), 5 deletions(-) diff --git a/src/cdk/v2/destinations/the_trade_desk/transformRecord.js b/src/cdk/v2/destinations/the_trade_desk/transformRecord.js index b452f8d7bc..42bbb0816d 100644 --- a/src/cdk/v2/destinations/the_trade_desk/transformRecord.js +++ b/src/cdk/v2/destinations/the_trade_desk/transformRecord.js @@ -40,6 +40,9 @@ const batchResponseBuilder = (items, config) => { return response; }; +const checkNullUndefinedEmptyFields = (fields) => + !!Object.entries(fields).some(([, value]) => !value); + const processRecordInputs = (inputs, destination) => { const { Config } = destination; const items = []; @@ -68,6 +71,11 @@ const processRecordInputs = (inputs, destination) => { return; } + if (checkNullUndefinedEmptyFields(fields)) { + errorResponseList.push(handleRtTfSingleEventError(input, emptyFieldsError, {})); + return; + } + successMetadata.push(input.metadata); const data = [ { @@ -78,10 +86,7 @@ const processRecordInputs = (inputs, destination) => { Object.keys(fields).forEach((id) => { const value = fields[id]; - if (value) { - // adding only non empty ID's - items.push({ [id]: value, Data: data }); - } + items.push({ [id]: value, Data: data }); }); }); diff --git a/test/integrations/destinations/the_trade_desk/router/data.ts b/test/integrations/destinations/the_trade_desk/router/data.ts index f095f561db..d2dbf9a7cc 100644 --- a/test/integrations/destinations/the_trade_desk/router/data.ts +++ b/test/integrations/destinations/the_trade_desk/router/data.ts @@ -45,7 +45,7 @@ export const data = [ action: 'insert', fields: { DAID: 'test-daid-2', - UID2: null, + UID2: 'test-uid2-2', }, channel: 'sources', context: sampleContext, @@ -117,6 +117,35 @@ export const data = [ }, files: {}, }, + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://sin-data.adsrvr.org/data/advertiser', + headers: {}, + params: {}, + body: { + JSON: { + DataProviderId: dataProviderId, + AdvertiserId: advertiserId, + Items: [ + { + UID2: 'test-uid2-2', + Data: [ + { + Name: segmentName, + TTLInMinutes: 43200, + }, + ], + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, ], metadata: [ { @@ -727,6 +756,8 @@ export const data = [ action: 'insert', fields: { DAID: 'test-daid-1', + UID2: 'test-uid2-1', + EUID: 'test-euid-1', }, channel: 'sources', context: sampleContext, @@ -737,6 +768,24 @@ export const data = [ jobId: 2, }, }, + { + message: { + type: 'record', + action: 'insert', + fields: { + DAID: 'test-daid-2', + UID2: null, + EUID: null, + }, + channel: 'sources', + context: sampleContext, + recordId: '3', + }, + destination: sampleDestination, + metadata: { + jobId: 3, + }, + }, ], destType, }, @@ -771,6 +820,24 @@ export const data = [ }, ], }, + { + UID2: 'test-uid2-1', + Data: [ + { + Name: segmentName, + TTLInMinutes: 43200, + }, + ], + }, + { + EUID: 'test-euid-1', + Data: [ + { + Name: segmentName, + TTLInMinutes: 43200, + }, + ], + }, ], }, JSON_ARRAY: {}, @@ -804,6 +871,21 @@ export const data = [ }, destination: sampleDestination, }, + { + batched: false, + metadata: [{ jobId: 3 }], + statusCode: 400, + error: '`fields` cannot be empty', + statTags: { + destType: destTypeInUpperCase, + implementation: 'cdkV2', + feature: 'router', + module: 'destination', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + }, + destination: sampleDestination, + }, ], }, }, From fc6bcf7eda690d82cfe2d381753948058efbcd3d Mon Sep 17 00:00:00 2001 From: Abhimanyu Babbar Date: Mon, 26 Aug 2024 23:37:33 +0530 Subject: [PATCH 2/2] fix: login using docker creds on the node to allow to pull the desired image (#3682) * fix: login using docker creds on the node to allow to pull the desired image * fix: add steps to create regcred secret and then patch deployment with it * chore: fix the github action * chore: patch the service account in openfaas-fn ns to allow for pulling openfaas flask base images * chore: minor fixes --- .github/workflows/ut-tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ut-tests.yml b/.github/workflows/ut-tests.yml index 2f2f303219..b825bdb9d3 100644 --- a/.github/workflows/ut-tests.yml +++ b/.github/workflows/ut-tests.yml @@ -66,6 +66,18 @@ jobs: --set gateway.image=rudderlabs/rudder-openfaas-gateway:0.25.2 \ --set faasnetes.image=rudderlabs/rudder-openfaas-faas-netes:0.15.4 + - name: Create regcred secret in openfaas + run: kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=${{ secrets.DOCKERHUB_USERNAME }} --docker-password=${{ secrets.DOCKERHUB_TOKEN }} --docker-email=${{ secrets.DOCKERHUB_EMAIL }} -n openfaas + + - name: Create regcred secret in openfaas-fn + run: kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=${{ secrets.DOCKERHUB_USERNAME }} --docker-password=${{ secrets.DOCKERHUB_TOKEN }} --docker-email=${{ secrets.DOCKERHUB_EMAIL }} -n openfaas-fn + + - name: Patch default service account in openfaas-fn + run: 'kubectl patch serviceaccount default -n openfaas-fn -p ''{"imagePullSecrets": [{"name": "regcred"}]}''' + + - name: Patch deployment "gateway" + run: 'kubectl patch deployment gateway -n openfaas -p ''{"spec": {"template": {"spec": {"imagePullSecrets": [{"name": "regcred"}]}}}}''' + - name: Wait for deployment "gateway" rollout run: kubectl rollout status deploy/gateway --timeout 120s -n openfaas