From 998e3a04e3ee044e65841adc54caac9bba7413d4 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Wed, 18 Dec 2024 12:15:38 +0530 Subject: [PATCH] fix(airship): resolved minor bugsnag error --- src/v0/destinations/airship/transform.js | 2 +- .../destinations/airship/processor/data.ts | 71 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/v0/destinations/airship/transform.js b/src/v0/destinations/airship/transform.js index fcf18daa7e..18b7a87547 100644 --- a/src/v0/destinations/airship/transform.js +++ b/src/v0/destinations/airship/transform.js @@ -149,7 +149,7 @@ const trackResponseBuilder = async (message, { Config }) => { } payload.name = name.replace(/\s+/g, '_'); - if (payload.value) { + if (payload.value && typeof payload.value === 'string') { payload.value.replace(/\s+/g, '_'); } const { appKey, dataCenter, apiKey } = Config; diff --git a/test/integrations/destinations/airship/processor/data.ts b/test/integrations/destinations/airship/processor/data.ts index 3c6d827ce6..973a6be0ec 100644 --- a/test/integrations/destinations/airship/processor/data.ts +++ b/test/integrations/destinations/airship/processor/data.ts @@ -1934,6 +1934,77 @@ export const data = [ }, }, }, + { + name: 'airship', + description: 'Test 16', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + event: 'Product Clicked', + userId: 'testuserId1', + properties: { value: 55 }, + integrations: { All: true }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + appKey: 'ffdf', + appSecret: 'fhf', + dataCenter: false, + }, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://go.urbanairship.com/api/custom-events', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/vnd.urbanairship+json; version=3', + 'X-UA-Appkey': 'ffdf', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + occured: '2019-10-14T09:03:17.562Z', + user: { named_user_id: 'testuserId1' }, + body: { name: 'product_clicked', value: 55 }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, { name: 'airship', description: 'Test 17',