From bed4bface6bf045a6513a445cf9d2b00c9197f0b Mon Sep 17 00:00:00 2001 From: Mihir Bhalala <77438541+mihir-4116@users.noreply.github.com> Date: Thu, 19 Oct 2023 09:59:43 +0530 Subject: [PATCH 1/4] chore: braze response added in error message (#2747) --- src/v0/destinations/braze/transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v0/destinations/braze/transform.js b/src/v0/destinations/braze/transform.js index 9816d792f1..26fd86b3dd 100644 --- a/src/v0/destinations/braze/transform.js +++ b/src/v0/destinations/braze/transform.js @@ -218,7 +218,7 @@ async function processIdentify(message, destination) { ); if (!isHttpStatusSuccess(brazeIdentifyResp.status)) { throw new NetworkError( - 'Braze identify failed', + `Braze identify failed - ${JSON.stringify(brazeIdentifyResp.response)}`, brazeIdentifyResp.status, { [tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(brazeIdentifyResp.status), From d72410f7962e702218be3c2414de62341ca29e39 Mon Sep 17 00:00:00 2001 From: Gauravudia <60897972+Gauravudia@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:32:30 +0530 Subject: [PATCH 2/4] chore: add gzip support compatibility (#2745) * chore: add gzip suppport compatibility * test: add gzip support header in testcase * refactor: use optional chaining --- src/v0/destinations/mp/transform.js | 8 +- src/v0/destinations/mp/util.js | 12 +- src/v0/destinations/mp/util.test.js | 9 +- src/v0/util/constant.js | 2 + src/v0/util/index.js | 23 +- .../destinations/mp/router/data.ts | 878 ++++++++++++++++++ 6 files changed, 915 insertions(+), 17 deletions(-) diff --git a/src/v0/destinations/mp/transform.js b/src/v0/destinations/mp/transform.js index bdae00e1c2..10e8eb0779 100644 --- a/src/v0/destinations/mp/transform.js +++ b/src/v0/destinations/mp/transform.js @@ -455,10 +455,10 @@ const processRouterDest = async (inputs, reqMetadata) => { const { engageEvents, groupsEvents, trackEvents, importEvents, batchErrorRespList } = groupEventsByEndpoint(transformedPayloads); - const engageRespList = batchEvents(engageEvents, ENGAGE_MAX_BATCH_SIZE); - const groupsRespList = batchEvents(groupsEvents, GROUPS_MAX_BATCH_SIZE); - const trackRespList = batchEvents(trackEvents, TRACK_MAX_BATCH_SIZE); - const importRespList = batchEvents(importEvents, IMPORT_MAX_BATCH_SIZE); + const engageRespList = batchEvents(engageEvents, ENGAGE_MAX_BATCH_SIZE, reqMetadata); + const groupsRespList = batchEvents(groupsEvents, GROUPS_MAX_BATCH_SIZE, reqMetadata); + const trackRespList = batchEvents(trackEvents, TRACK_MAX_BATCH_SIZE, reqMetadata); + const importRespList = batchEvents(importEvents, IMPORT_MAX_BATCH_SIZE, reqMetadata); const batchSuccessRespList = [ ...engageRespList, ...groupsRespList, diff --git a/src/v0/destinations/mp/util.js b/src/v0/destinations/mp/util.js index 409092106c..abc4134302 100644 --- a/src/v0/destinations/mp/util.js +++ b/src/v0/destinations/mp/util.js @@ -11,6 +11,7 @@ const { batchMultiplexedEvents, getSuccessRespEvents, defaultBatchRequestConfig, + IsGzipSupported, } = require('../../util'); const { ConfigCategory, @@ -212,7 +213,7 @@ const groupEventsByEndpoint = (events) => { }; }; -const generateBatchedPayloadForArray = (events) => { +const generateBatchedPayloadForArray = (events, reqMetadata) => { const { batchedRequest } = defaultBatchRequestConfig(); const firstEvent = events[0]; batchedRequest.endpoint = firstEvent.endpoint; @@ -220,8 +221,9 @@ const generateBatchedPayloadForArray = (events) => { batchedRequest.params = firstEvent.params; const batchResponseList = events.flatMap((event) => JSON.parse(event.body.JSON_ARRAY.batch)); - // Gzipping the payload for /import endpoint - if (firstEvent.endpoint.includes('import')) { + + if (IsGzipSupported(reqMetadata) && firstEvent.endpoint.includes('import')) { + // Gzipping the payload for /import endpoint batchedRequest.body.GZIP = { payload: JSON.stringify(batchResponseList) }; } else { batchedRequest.body.JSON_ARRAY = { batch: JSON.stringify(batchResponseList) }; @@ -230,10 +232,10 @@ const generateBatchedPayloadForArray = (events) => { return batchedRequest; }; -const batchEvents = (successRespList, maxBatchSize) => { +const batchEvents = (successRespList, maxBatchSize, reqMetadata) => { const batchedEvents = batchMultiplexedEvents(successRespList, maxBatchSize); return batchedEvents.map((batch) => { - const batchedRequest = generateBatchedPayloadForArray(batch.events); + const batchedRequest = generateBatchedPayloadForArray(batch.events, reqMetadata); return getSuccessRespEvents(batchedRequest, batch.metadata, batch.destination, true); }); }; diff --git a/src/v0/destinations/mp/util.test.js b/src/v0/destinations/mp/util.test.js index c707d09dfe..b5a1e90a9a 100644 --- a/src/v0/destinations/mp/util.test.js +++ b/src/v0/destinations/mp/util.test.js @@ -4,6 +4,7 @@ const { batchEvents, generateBatchedPayloadForArray, } = require('./util'); +const { FEATURE_GZIP_SUPPORT } = require('../../util/constant'); const destinationMock = { Config: { @@ -524,7 +525,9 @@ describe('Mixpanel utils test', () => { version: '1', }; - const result = generateBatchedPayloadForArray(events); + const result = generateBatchedPayloadForArray(events, { + features: { [FEATURE_GZIP_SUPPORT]: true }, + }); expect(result).toEqual(expectedBatchedRequest); }); @@ -560,7 +563,9 @@ describe('Mixpanel utils test', () => { version: '1', }; - const result = generateBatchedPayloadForArray(events); + const result = generateBatchedPayloadForArray(events, { + features: { [FEATURE_GZIP_SUPPORT]: true }, + }); expect(result).toEqual(expectedBatchedRequest); }); diff --git a/src/v0/util/constant.js b/src/v0/util/constant.js index 50f1b76a74..9996f1ea7c 100644 --- a/src/v0/util/constant.js +++ b/src/v0/util/constant.js @@ -11,6 +11,7 @@ const API_CALL = 'api_call_count'; const JSON_MIME_TYPE = 'application/json'; const FEATURE_FILTER_CODE = 'filter-code'; +const FEATURE_GZIP_SUPPORT = 'gzip-support'; const HTTP_STATUS_CODES = { // 1xx Informational @@ -89,4 +90,5 @@ module.exports = { HTTP_STATUS_CODES, USER_LEAD_CACHE_TTL, FEATURE_FILTER_CODE, + FEATURE_GZIP_SUPPORT, }; diff --git a/src/v0/util/index.js b/src/v0/util/index.js index f534f1acca..cd9bd82efd 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -32,7 +32,8 @@ const { REFRESH_TOKEN, AUTH_STATUS_INACTIVE, } = require('../../adapters/networkhandler/authConstants'); -const { FEATURE_FILTER_CODE } = require('./constant'); +const { FEATURE_FILTER_CODE, FEATURE_GZIP_SUPPORT } = require('./constant'); + // ======================================================================== // INLINERS // ======================================================================== @@ -372,7 +373,7 @@ const hashToSha256 = (value) => sha256(value); // Check what type of gender and convert to f or m const getFbGenderVal = (gender) => { - if (typeof (gender) !== 'string') { + if (typeof gender !== 'string') { return null; } if ( @@ -2050,11 +2051,20 @@ const getAuthErrCategoryFromStCode = (status) => { return ''; }; -const validateEventType = event => { - if(!event || typeof event !== "string"){ - throw new InstrumentationError("Event is a required field and should be a string"); +const validateEventType = (event) => { + if (!event || typeof event !== 'string') { + throw new InstrumentationError('Event is a required field and should be a string'); } -} +}; + +const IsGzipSupported = (reqMetadata = {}) => { + if (reqMetadata && typeof reqMetadata === 'object' && !Array.isArray(reqMetadata)) { + const { features } = reqMetadata; + return !!features?.[FEATURE_GZIP_SUPPORT]; + } + return false; +}; + // ======================================================================== // EXPORTS // ======================================================================== @@ -2161,4 +2171,5 @@ module.exports = { getAuthErrCategoryFromErrDetailsAndStCode, getAuthErrCategoryFromStCode, isNewStatusCodesAccepted, + IsGzipSupported, }; diff --git a/test/integrations/destinations/mp/router/data.ts b/test/integrations/destinations/mp/router/data.ts index 7e0de0693d..7058929909 100644 --- a/test/integrations/destinations/mp/router/data.ts +++ b/test/integrations/destinations/mp/router/data.ts @@ -542,6 +542,9 @@ export const data = [ destType: 'mp', }, method: 'POST', + headers: { + 'X-Feature-Gzip-Support': '?1', + }, }, }, output: { @@ -880,4 +883,879 @@ export const data = [ }, }, }, + { + name: 'mp', + description: 'Test 1', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + description: 'Page call', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + useOldMapping: true, + strictMode: true, + }), + metadata: { + jobId: 1, + additionalProp: 1, + }, + message: { + anonymousId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', + channel: 'web', + name: 'Contact Us', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: {}, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: 'dd266c67-9199-4a52-ba32-f46ddde67312', + originalTimestamp: '2020-01-24T06:29:02.358Z', + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53708', + sentAt: '2020-01-24T06:29:02.359Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + type: 'page', + userId: 'hjikl', + }, + }, + { + description: + 'Track: set device id and user id when simplified id merge api is selected', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + identityMergeApi: 'simplified', + strictMode: true, + }), + metadata: { + jobId: 2, + additionalProp: 2, + }, + message: { + anonymousId: 'anonId01', + channel: 'mobile', + context: { + app: { + build: '1', + name: 'LeanPlumIntegrationAndroid', + namespace: 'com.android.SampleLeanPlum', + version: '1.0', + }, + device: { + id: '5094f5704b9cf2b3', + manufacturer: 'Google', + model: 'Android SDK built for x86', + name: 'generic_x86', + type: 'ios', + token: 'test_device_token', + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.1-beta.1', + }, + locale: 'en-US', + network: { + carrier: 'Android', + bluetooth: false, + cellular: true, + wifi: true, + }, + os: { + name: 'iOS', + version: '8.1.0', + }, + screen: { + density: 420, + height: 1794, + width: 1080, + }, + timezone: 'Asia/Kolkata', + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 8.1.0; Android SDK built for x86 Build/OSM1.180201.007)', + }, + event: 'Product Viewed', + integrations: { + All: true, + }, + userId: 'userId01', + messageId: 'id2', + properties: { + name: 'T-Shirt', + revenue: 18.9, + }, + type: 'track', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + }, + }, + { + description: 'Identify call to create anonymous user profile', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + useOldMapping: true, + strictMode: true, + }), + metadata: { + jobId: 3, + additionalProp: 3, + }, + message: { + anonymousId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + city: 'Disney', + country: 'USA', + email: 'mickey@disney.com', + firstName: 'Mickey', + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + messageId: '2536eda4-d638-4c93-8014-8ffe3f083214', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53709', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + type: 'identify', + userId: '', + }, + }, + { + description: + 'Identify: append $device: to deviceId while creating the user when simplified id merge api is selected', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + identityMergeApi: 'simplified', + strictMode: true, + }), + metadata: { + jobId: 4, + additionalProp: 4, + }, + message: { + anonymousId: 'anonId01', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + city: 'Disney', + country: 'USA', + email: 'mickey@disney.com', + firstName: 'Mickey', + lastName: 'Mouse', + createdAt: '2020-01-23T08:54:02.362Z', + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + messageId: '2536eda4-d638-4c93-8014-8ffe3f083214', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53709', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + type: 'identify', + }, + }, + { + description: 'Merge call with strict mode enabled', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + strictMode: true, + }), + metadata: { + jobId: 5, + additionalProp: 5, + }, + message: { + anonymousId: '5094f5704b9cf2b3', + channel: 'mobile', + context: { + app: { + build: '1', + name: 'LeanPlumIntegrationAndroid', + namespace: 'com.android.SampleLeanPlum', + version: '1.0', + }, + device: { + id: '5094f5704b9cf2b3', + manufacturer: 'Google', + model: 'Android SDK built for x86', + name: 'generic_x86', + type: 'ios', + token: 'test_device_token', + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.1-beta.1', + }, + locale: 'en-US', + network: { + carrier: 'Android', + bluetooth: false, + cellular: true, + wifi: true, + }, + os: { + name: 'iOS', + version: '8.1.0', + }, + screen: { + density: 420, + height: 1794, + width: 1080, + }, + timezone: 'Asia/Kolkata', + traits: { + anonymousId: '5094f5704b9cf2b3', + userId: 'test_user_id', + }, + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 8.1.0; Android SDK built for x86 Build/OSM1.180201.007)', + }, + event: 'MainActivity', + integrations: { + All: true, + }, + userId: 'test_user_id', + messageId: 'id2', + properties: { + name: 'MainActivity', + automatic: true, + }, + originalTimestamp: '2020-03-12T09:05:03.421Z', + type: 'identify', + sentAt: '2020-03-12T09:05:13.042Z', + }, + }, + { + description: 'Group call', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + groupKeySettings: [ + { + groupKey: 'company', + }, + ], + strictMode: true, + }), + metadata: { + jobId: 6, + additionalProp: 6, + }, + message: { + anonymousId: 'anonId06', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + traits: { + company: 'testComp', + }, + messageId: '2536eda4-d638-4c93-8014-8ffe3f083214', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53709', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + type: 'group', + userId: 'userId06', + }, + }, + { + description: 'Group key not present in traits', + destination: overrideDestination(sampleDestination, { + apiSecret: 'test_api_secret', + token: 'test_api_token', + groupKeySettings: [ + { + groupKey: 'company', + }, + ], + strictMode: true, + }), + metadata: { + jobId: 7, + additionalProp: 7, + }, + message: { + anonymousId: 'anonId06', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + messageId: '2536eda4-d638-4c93-8014-8ffe3f083214', + originalTimestamp: '2020-01-24T06:29:02.362Z', + receivedAt: '2020-01-24T11:59:02.403+05:30', + request_ip: '[::1]:53709', + sentAt: '2020-01-24T06:29:02.363Z', + timestamp: '2023-07-06T11:59:02.402+05:30', + type: 'group', + userId: 'userId06', + }, + }, + ], + destType: 'mp', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/import/', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + }, + params: { + strict: 1, + }, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"event":"Loaded a Page","properties":{"ip":"0.0.0.0","$user_id":"hjikl","$current_url":"https://docs.rudderstack.com/destinations/mixpanel","$screen_dpi":2,"mp_lib":"RudderLabs JavaScript SDK","$app_build_number":"1.0.0","$app_version_string":"1.0.5","$insert_id":"dd266c67-9199-4a52-ba32-f46ddde67312","token":"test_api_token","distinct_id":"hjikl","time":1688624942,"name":"Contact Us","$browser":"Chrome","$browser_version":"79.0.3945.117"}}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 1, + additionalProp: 1, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + apiSecret: 'test_api_secret', + token: 'test_api_token', + prefixProperties: true, + useNativeSDK: false, + useOldMapping: true, + strictMode: true, + }, + DestinationDefinition: { + DisplayName: 'Mixpanel', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MP', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'MP', + Transformations: [], + }, + }, + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$append":{"$transactions":{"$time":"2023-07-06T06:29:02.402Z","$amount":18.9}},"$token":"test_api_token","$distinct_id":"userId01"}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/import/', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + }, + params: { + strict: 1, + }, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"event":"Product Viewed","properties":{"name":"T-Shirt","revenue":18.9,"$user_id":"userId01","$os":"iOS","$screen_height":1794,"$screen_width":1080,"$screen_dpi":420,"$carrier":"Android","$os_version":"8.1.0","$device":"generic_x86","$manufacturer":"Google","$model":"Android SDK built for x86","mp_device_model":"Android SDK built for x86","$wifi":true,"$bluetooth_enabled":false,"mp_lib":"com.rudderstack.android.sdk.core","$app_build_number":"1","$app_version_string":"1.0","$insert_id":"id2","token":"test_api_token","distinct_id":"userId01","time":1688624942,"$device_id":"anonId01"}}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { + jobId: 2, + additionalProp: 2, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + apiSecret: 'test_api_secret', + token: 'test_api_token', + prefixProperties: true, + identityMergeApi: 'simplified', + strictMode: true, + useNativeSDK: false, + }, + DestinationDefinition: { + DisplayName: 'Mixpanel', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MP', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'MP', + Transformations: [], + }, + }, + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$set":{"$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$firstName":"Mickey","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"e6ab2c5e-2cda-44a9-a962-e2f67df78bca","$ip":"0.0.0.0","$time":1688624942},{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"mickey@disney.com","$country_code":"USA","$city":"Disney","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","$name":"Mickey Mouse","$firstName":"Mickey","$lastName":"Mouse","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"test_api_token","$distinct_id":"$device:anonId01","$ip":"0.0.0.0","$time":1688624942},{"$set":{"$carrier":"Android","$manufacturer":"Google","$model":"Android SDK built for x86","$screen_height":1794,"$screen_width":1080,"$wifi":true,"anonymousId":"5094f5704b9cf2b3","userId":"test_user_id","$ios_devices":["test_device_token"],"$os":"iOS","$ios_device_model":"Android SDK built for x86","$ios_version":"8.1.0","$ios_app_release":"1","$ios_app_version":"1.0"},"$token":"test_api_token","$distinct_id":"test_user_id","$time":null}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/import/', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdF9hcGlfc2VjcmV0Og==', + }, + params: { + strict: 1, + }, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"event":"$merge","properties":{"$distinct_ids":["test_user_id","5094f5704b9cf2b3"],"token":"test_api_token"}}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { + jobId: 3, + additionalProp: 3, + }, + { + jobId: 4, + additionalProp: 4, + }, + { + jobId: 5, + additionalProp: 5, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + apiSecret: 'test_api_secret', + token: 'test_api_token', + prefixProperties: true, + useNativeSDK: false, + useOldMapping: true, + strictMode: true, + }, + DestinationDefinition: { + DisplayName: 'Mixpanel', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MP', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'MP', + Transformations: [], + }, + }, + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$token":"test_api_token","$distinct_id":"userId06","$set":{"company":["testComp"]},"$ip":"0.0.0.0"}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/groups/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$token":"test_api_token","$group_key":"company","$group_id":"testComp","$set":{"company":"testComp"}}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { + jobId: 6, + additionalProp: 6, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + apiSecret: 'test_api_secret', + token: 'test_api_token', + prefixProperties: true, + groupKeySettings: [ + { + groupKey: 'company', + }, + ], + strictMode: true, + useNativeSDK: false, + }, + DestinationDefinition: { + DisplayName: 'Mixpanel', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MP', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'MP', + Transformations: [], + }, + }, + { + metadata: [ + { + jobId: 7, + additionalProp: 7, + }, + ], + batched: false, + statusCode: 400, + error: + 'Group Key is not present. Please ensure that the group key is included in the payload as configured in the `Group Key Settings` in destination', + statTags: { + destType: 'MP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + apiSecret: 'test_api_secret', + token: 'test_api_token', + prefixProperties: true, + useNativeSDK: false, + groupKeySettings: [ + { + groupKey: 'company', + }, + ], + strictMode: true, + }, + DestinationDefinition: { + DisplayName: 'Mixpanel', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MP', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'MP', + Transformations: [], + }, + }, + ], + }, + }, + }, + }, ]; From 20678a521593cdf5a49777fb31b2540462afbed4 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 19 Oct 2023 06:40:59 +0000 Subject: [PATCH 3/4] chore(release): 1.46.1 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 562f8582d2..4c8908ff1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.46.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.0...v1.46.1) (2023-10-19) + ## [1.46.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.45.3...v1.46.0) (2023-10-18) diff --git a/package-lock.json b/package-lock.json index 68108ae808..322e3dbca0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.46.0", + "version": "1.46.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.46.0", + "version": "1.46.1", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "^0.7.24", diff --git a/package.json b/package.json index d31f9a2fbe..880acda150 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.46.0", + "version": "1.46.1", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { From b649105eaf93a3946a8ced2c7398f2e59d2dd372 Mon Sep 17 00:00:00 2001 From: Gauravudia <60897972+Gauravudia@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:18:12 +0530 Subject: [PATCH 4/4] chore: update changelog (#2750) --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8908ff1a..1a520c5b6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. See [standa ### [1.46.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.0...v1.46.1) (2023-10-19) +### Bug Fixes + +* add gzip support compatibility ([#2745](https://github.com/rudderlabs/rudder-transformer/issues/2745)) ([d72410f](https://github.com/rudderlabs/rudder-transformer/commit/d72410f7962e702218be3c2414de62341ca29e39)) + ## [1.46.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.45.3...v1.46.0) (2023-10-18)