diff --git a/src/types/index.ts b/src/types/index.ts index 5a35b697d6..79efaecb40 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -137,7 +137,7 @@ type SourceTransformationResponse = { type DeliveryResponse = { status: number; message: string; - destinationResponse: object; + destinationResponse: any; statTags: object; authErrorCategory?: string; }; diff --git a/src/v0/util/index.js b/src/v0/util/index.js index cd9bd82efd..4ea3d3783d 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -1473,13 +1473,22 @@ const getErrorStatusCode = (error, defaultStatusCode = HTTP_STATUS_CODES.INTERNA /** * Used for generating error response with stats from native and built errors */ -function generateErrorObject(error, defTags = {}, shouldEnrichErrorMessage = false) { - let errObject = error; +function generateErrorObject(error, defTags = {}, shouldEnrichErrorMessage = true) { + let errObject = new BaseError( + error.message, + getErrorStatusCode(error), + { + ...error.statTags, + ...defTags, + }, + error.destinationResponse, + error.authErrorCategory, + ); let errorMessage = error.message; if (shouldEnrichErrorMessage) { if (error.destinationResponse) { errorMessage = JSON.stringify({ - message: error.message, + message: errorMessage, destinationResponse: error.destinationResponse, }); } @@ -1488,13 +1497,6 @@ function generateErrorObject(error, defTags = {}, shouldEnrichErrorMessage = fal if (!(error instanceof BaseError)) { errObject = new TransformationError(errorMessage, getErrorStatusCode(error)); } - - // Add higher level default tags - errObject.statTags = { - ...errObject.statTags, - ...defTags, - }; - return errObject; } /** diff --git a/test/__tests__/data/marketo_router_output.json b/test/__tests__/data/marketo_router_output.json index aa0a50bbad..a8877399e9 100644 --- a/test/__tests__/data/marketo_router_output.json +++ b/test/__tests__/data/marketo_router_output.json @@ -328,7 +328,7 @@ { "batched": false, "statusCode": 400, - "error": "Request Failed for marketo, Lookup field 'userId' not found (Aborted).[Marketo Transformer]: During lead look up using email", + "error": "{\"message\":\"Request Failed for marketo, Lookup field 'userId' not found (Aborted).[Marketo Transformer]: During lead look up using email\",\"destinationResponse\":{\"response\":{\"requestId\":\"142e4#1835b117b76\",\"success\":false,\"errors\":[{\"code\":\"1006\",\"message\":\"Lookup field 'userId' not found\"}]},\"status\":200}}", "statTags": { "errorCategory": "network", "errorType": "aborted" @@ -479,7 +479,7 @@ { "batched": false, "statusCode": 400, - "error": "Error occurred [Marketo Transformer]: During lead look up using email -> some other problem", + "error": "{\"message\":\"Error occurred [Marketo Transformer]: During lead look up using email -> some other problem\",\"destinationResponse\":{\"response\":{\"requestId\":\"142e4#1835b117b76\",\"success\":false,\"errors\":[{\"code\":\"random_marketo_code\",\"message\":\"some other problem\"}]},\"status\":200}}", "statTags": { "errorCategory": "network", "errorType": "aborted", diff --git a/test/integrations/destinations/autopilot/processor/data.ts b/test/integrations/destinations/autopilot/processor/data.ts index 1fe7dfc97e..8ae3e28671 100644 --- a/test/integrations/destinations/autopilot/processor/data.ts +++ b/test/integrations/destinations/autopilot/processor/data.ts @@ -1,1156 +1,1251 @@ export const data = [ - { - "name": "autopilot", - "description": "Test 0", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "fad9b3fb-5778-4db3-9fb6-7168b554191f", - "originalTimestamp": "2020-04-17T14:42:44.722Z", - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53513", - "sentAt": "2020-04-17T14:42:44.722Z", - "traits": { - "age": 23, - "email": "testmp@rudderstack.com", - "firstname": "Test Kafka" - }, - "timestamp": "2020-04-17T20:12:44.758+05:30", - "type": "identify", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api2.autopilothq.com/v1/contact", - "headers": { - "Accept": "application/json", - "autopilotapikey": "dummyApiKey", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "contact": { - "Email": "testmp@rudderstack.com", - "FirstName": "Test Kafka", - "custom": { - "age": 23 - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 1", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "email": "testmp@rudderstack.com", - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "type": "track", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api2.autopilothq.com/v1/trigger/00XX/contact/testmp@rudderstack.com", - "headers": { - "Accept": "application/json", - "autopilotapikey": "dummyApiKey", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "property": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 2", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "email": "testmp@rudderstack.com", - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "type": "page", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 3", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "type": "track", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 4", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 5", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "email": "testmp@rudderstack.com", - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "type": "group", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 6", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "abc@rudderstack.com", - "firstname": "Anuraj" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "integrations": { - "All": true - }, - "originalTimestamp": "2020-04-17T14:42:44.722Z", - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53513", - "sentAt": "2020-04-17T14:42:44.722Z", - "timestamp": "2020-04-17T20:12:44.758+05:30", - "type": "identify", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api2.autopilothq.com/v1/contact", - "headers": { - "Accept": "application/json", - "autopilotapikey": "dummyApiKey", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "contact": { - "Email": "abc@rudderstack.com", - "FirstName": "Anuraj" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 7", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "age": 23, - "email": "testmp@rudderstack.com", - "firstname": "Test Kafka" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "event": "test track with property", - "integrations": { - "All": true - }, - "messageId": "37b75e61-9bd2-4fb8-91ed-e3a064905f3a", - "originalTimestamp": "2020-04-17T14:42:44.724Z", - "properties": { - "test_prop_1": "test prop", - "test_prop_2": 1232 - }, - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53512", - "sentAt": "2020-04-17T14:42:44.725Z", - "timestamp": "2020-04-17T20:12:44.757+05:30", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 8", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "abc@rudderstack.com", - "firstname": "Anuraj" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "integrations": { - "All": true - }, - "originalTimestamp": "2020-04-17T14:42:44.722Z", - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53513", - "sentAt": "2020-04-17T14:42:44.722Z", - "timestamp": "2020-04-17T20:12:44.758+05:30", - "type": "group", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "autopilot", - "description": "Test 9", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "destination": { - "ID": "1afjtc6chkhdeKsXYrNFOzR5D9v", - "Name": "Autopilot", - "DestinationDefinition": { - "ID": "1afjX4MlAucK57Q0ctTVlD27Tvo", - "Name": "AUTOPILOT", - "DisplayName": "Autopilot", - "Config": { - "cdkEnabled": true, - "excludeKeys": [], - "includeKeys": [] - } - }, - "Config": { - "apiKey": "dummyApiKey", - "customMappings": [ - { - "from": "0001", - "to": "Signup" - } - ], - "triggerId": "00XX" - }, - "Enabled": true, - "Transformations": [], - "IsProcessorEnabled": true - }, - "message": { - "anonymousId": "ac7722c2-ccb6-4ae2-baf6-1effe861f4cd", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.1-rc.2" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.1-rc.2" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "page": { - "path": "/tests/html/index4.html", - "referrer": "", - "search": "", - "title": "", - "url": "http://localhost/tests/html/index4.html" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "abc@rudderstack.com", - "firstname": "Anuraj" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" - }, - "integrations": { - "All": true - }, - "originalTimestamp": "2020-04-17T14:42:44.722Z", - "receivedAt": "2020-04-17T20:12:44.758+05:30", - "request_ip": "[::1]:53513", - "sentAt": "2020-04-17T14:42:44.722Z", - "timestamp": "2020-04-17T20:12:44.758+05:30", - "type": "Tals", - "userId": "user12345" - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 500, - "error": "Cannot read properties of undefined (reading 'destinationId')", - "statTags": { - "errorCategory": "transformation", - "destType": "AUTOPILOT", - "module": "destination", - "implementation": "cdkV1", - "feature": "processor" - } - } - ] - } - } - } -] \ No newline at end of file + { + name: 'autopilot', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: 'fad9b3fb-5778-4db3-9fb6-7168b554191f', + originalTimestamp: '2020-04-17T14:42:44.722Z', + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53513', + sentAt: '2020-04-17T14:42:44.722Z', + traits: { + age: 23, + email: 'testmp@rudderstack.com', + firstname: 'Test Kafka', + }, + timestamp: '2020-04-17T20:12:44.758+05:30', + type: 'identify', + userId: 'user12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api2.autopilothq.com/v1/contact', + headers: { + Accept: 'application/json', + autopilotapikey: 'dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + contact: { + Email: 'testmp@rudderstack.com', + FirstName: 'Test Kafka', + custom: { + age: 23, + }, + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + email: 'testmp@rudderstack.com', + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + type: 'track', + userId: 'user12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://api2.autopilothq.com/v1/trigger/00XX/contact/testmp@rudderstack.com', + headers: { + Accept: 'application/json', + autopilotapikey: 'dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + property: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + email: 'testmp@rudderstack.com', + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + type: 'page', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Bad event. Original error: message type "page" not supported for "autopilot"', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + type: 'track', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Unknown error occurred. Original error: Email is required for track calls', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'transformation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'Unknown error occurred. Original error: "type" is a required field and it must be a string', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'transformation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + email: 'testmp@rudderstack.com', + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + type: 'group', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Bad event. Original error: message type "group" not supported for "autopilot"', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + email: 'abc@rudderstack.com', + firstname: 'Anuraj', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + integrations: { + All: true, + }, + originalTimestamp: '2020-04-17T14:42:44.722Z', + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53513', + sentAt: '2020-04-17T14:42:44.722Z', + timestamp: '2020-04-17T20:12:44.758+05:30', + type: 'identify', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api2.autopilothq.com/v1/contact', + headers: { + Accept: 'application/json', + autopilotapikey: 'dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + contact: { + Email: 'abc@rudderstack.com', + FirstName: 'Anuraj', + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + age: 23, + email: 'testmp@rudderstack.com', + firstname: 'Test Kafka', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + event: 'test track with property', + integrations: { + All: true, + }, + messageId: '37b75e61-9bd2-4fb8-91ed-e3a064905f3a', + originalTimestamp: '2020-04-17T14:42:44.724Z', + properties: { + test_prop_1: 'test prop', + test_prop_2: 1232, + }, + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53512', + sentAt: '2020-04-17T14:42:44.725Z', + timestamp: '2020-04-17T20:12:44.757+05:30', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'Unknown error occurred. Original error: "type" is a required field and it must be a string', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'transformation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + email: 'abc@rudderstack.com', + firstname: 'Anuraj', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + integrations: { + All: true, + }, + originalTimestamp: '2020-04-17T14:42:44.722Z', + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53513', + sentAt: '2020-04-17T14:42:44.722Z', + timestamp: '2020-04-17T20:12:44.758+05:30', + type: 'group', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Bad event. Original error: message type "group" not supported for "autopilot"', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'autopilot', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1afjtc6chkhdeKsXYrNFOzR5D9v', + Name: 'Autopilot', + DestinationDefinition: { + ID: '1afjX4MlAucK57Q0ctTVlD27Tvo', + Name: 'AUTOPILOT', + DisplayName: 'Autopilot', + Config: { + cdkEnabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, + Config: { + apiKey: 'dummyApiKey', + customMappings: [ + { + from: '0001', + to: 'Signup', + }, + ], + triggerId: '00XX', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + message: { + anonymousId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.1-rc.2', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.1-rc.2', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + page: { + path: '/tests/html/index4.html', + referrer: '', + search: '', + title: '', + url: 'http://localhost/tests/html/index4.html', + }, + screen: { + density: 2, + }, + traits: { + email: 'abc@rudderstack.com', + firstname: 'Anuraj', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', + }, + integrations: { + All: true, + }, + originalTimestamp: '2020-04-17T14:42:44.722Z', + receivedAt: '2020-04-17T20:12:44.758+05:30', + request_ip: '[::1]:53513', + sentAt: '2020-04-17T14:42:44.722Z', + timestamp: '2020-04-17T20:12:44.758+05:30', + type: 'Tals', + userId: 'user12345', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Bad event. Original error: message type "Tals" not supported for "autopilot"', + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'AUTOPILOT', + module: 'destination', + implementation: 'cdkV1', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/optimizely_fullstack/processor/data.ts b/test/integrations/destinations/optimizely_fullstack/processor/data.ts index 47ce3314fd..09749178ee 100644 --- a/test/integrations/destinations/optimizely_fullstack/processor/data.ts +++ b/test/integrations/destinations/optimizely_fullstack/processor/data.ts @@ -591,7 +591,7 @@ export const data = [ body: [ { error: - 'Data File Lookup Failed due to {"code":"document_not_found","message":"document_not_found"}: Workflow: procWorkflow, Step: dataFile, ChildStep: undefined, OriginalError: Data File Lookup Failed due to {"code":"document_not_found","message":"document_not_found"}', + '{"message":"Data File Lookup Failed due to {\\"code\\":\\"document_not_found\\",\\"message\\":\\"document_not_found\\"}: Workflow: procWorkflow, Step: dataFile, ChildStep: undefined, OriginalError: Data File Lookup Failed due to {\\"code\\":\\"document_not_found\\",\\"message\\":\\"document_not_found\\"}","destinationResponse":{"code":"document_not_found","message":"document_not_found"}}', statTags: { destType: 'OPTIMIZELY_FULLSTACK', errorCategory: 'platform', diff --git a/test/integrations/destinations/zendesk/processor/data.ts b/test/integrations/destinations/zendesk/processor/data.ts index 6af4e78b93..4dab6c5d5d 100644 --- a/test/integrations/destinations/zendesk/processor/data.ts +++ b/test/integrations/destinations/zendesk/processor/data.ts @@ -2355,7 +2355,7 @@ export const data = [ body: [ { error: - "Failed to fetch user with email: testemail2@email due to Couldn't find user: John Wick", + '{"message":"Failed to fetch user with email: testemail2@email due to Couldn\'t find user: John Wick","destinationResponse":{"status":400,"statTags":{"errorCategory":"network","errorType":"aborted","meta":"instrumentation"},"destinationResponse":"","authErrorCategory":""}}', statTags: { destType: 'ZENDESK', errorCategory: 'network', diff --git a/test/integrations/destinations/zendesk/router/data.ts b/test/integrations/destinations/zendesk/router/data.ts index 9ee5637282..d99ca6df03 100644 --- a/test/integrations/destinations/zendesk/router/data.ts +++ b/test/integrations/destinations/zendesk/router/data.ts @@ -383,7 +383,7 @@ export const data = [ output: [ { error: - "Failed to fetch user with email: testemail2@email due to Couldn't find user: John Wick", + '{"message":"Failed to fetch user with email: testemail2@email due to Couldn\'t find user: John Wick","destinationResponse":{"status":400,"statTags":{"errorCategory":"network","errorType":"aborted","meta":"instrumentation"},"destinationResponse":"","authErrorCategory":""}}', statTags: { destType: 'ZENDESK', errorCategory: 'network',