From f7afdac988d288f78c86e025d2fa85cbf03356ea Mon Sep 17 00:00:00 2001 From: Sai Sankeerth Date: Tue, 21 May 2024 12:15:27 +0530 Subject: [PATCH 1/2] fix: bugsnag issue in braze for processor transformation Signed-off-by: Sai Sankeerth --- src/v0/destinations/braze/transform.js | 5 ++++- src/v0/util/index.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/v0/destinations/braze/transform.js b/src/v0/destinations/braze/transform.js index d45640272e..418a270c15 100644 --- a/src/v0/destinations/braze/transform.js +++ b/src/v0/destinations/braze/transform.js @@ -471,10 +471,13 @@ function processAlias(message, destination) { ); } -async function process(event, processParams = { userStore: new Map() }, reqMetadata = {}) { +async function process(event, reqMetadata = {}, processParams = { userStore: new Map() }) { let response; const { message, destination } = event; const messageType = message.type.toLowerCase(); + if (!processParams?.userStore) { + processParams.userStore = new Map(); + } let category = ConfigCategory.DEFAULT; switch (messageType) { diff --git a/src/v0/util/index.js b/src/v0/util/index.js index ac1bacf404..06082af11f 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -1764,7 +1764,7 @@ const simpleProcessRouterDestSync = async (inputs, singleTfFunc, reqMetadata, pr // transform if not already done if (!input.message.statusCode) { // eslint-disable-next-line no-await-in-loop - resp = await singleTfFunc(input, processParams, reqMetadata); + resp = await singleTfFunc(input, reqMetadata, processParams); } respList.push(getSuccessRespEvents(resp, [input.metadata], input.destination)); } catch (error) { From 6eb12e454fa6b97e29c10efa12886b98e7f9b988 Mon Sep 17 00:00:00 2001 From: Sai Sankeerth Date: Tue, 21 May 2024 13:02:02 +0530 Subject: [PATCH 2/2] chore: update parameters for simpleProcessRouterDest Signed-off-by: Sai Sankeerth --- src/v0/util/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v0/util/index.js b/src/v0/util/index.js index 06082af11f..1785eacbcd 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -1735,7 +1735,7 @@ const simpleProcessRouterDest = async (inputs, singleTfFunc, reqMetadata, proces let resp = input.message; // transform if not already done if (!input.message.statusCode) { - resp = await singleTfFunc(input, processParams); + resp = await singleTfFunc(input, reqMetadata, processParams); } return getSuccessRespEvents(resp, [input.metadata], input.destination);