Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugsnag issue in moengage identify event #2845

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/v0/destinations/moengage/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const processEvent = (message, destination) => {
response = responseBuilderSimple(message, category, destination);
// only if device information is present device info will be added/updated
// with an identify call otherwise only user info will be added/updated
if (message.context.device && message.context.device.type && message.context.device.token) {
if (message?.context?.device?.type && message?.context?.device?.token) {
// build the response
response = [
// user api payload (output for identify)
Expand Down
101 changes: 101 additions & 0 deletions test/integrations/destinations/moengage/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2777,4 +2777,105 @@ export const data = [
},
},
},
{
name: 'moengage',
description:
'when identify is sent without context, the event should not throw internal server error',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
type: 'identify',
event: 'identify',
sentAt: '2023-11-22T03:42:40.346Z',
userId: 'userId16',
channel: 'mobile',
rudderId: 'dummy-rudderId',
timestamp: '2023-11-22T03:42:31.470Z',
receivedAt: '2023-11-22T03:42:43.281Z',
request_ip: '114.122.233.48',
anonymousId: 'anon-dummyId-1',
integrations: {
All: true,
},
originalTimestamp: '2023-11-22T03:42:28.535Z',
},
destination: {
ID: '1iuTZs6eEZVMm6GjRBe6bNShaL3',
Name: 'MoEngage Testing',
DestinationDefinition: {
ID: '1iu4802Tx27kNC4KNYYou6D8jzL',
Name: 'MOENGAGE',
DisplayName: 'MoEngage',
Config: {
destConfig: { defaultConfig: ['apiId', 'apiKey', 'region'] },
excludeKeys: [],
includeKeys: [],
supportedSourceTypes: [
'android',
'ios',
'web',
'unity',
'amp',
'cloud',
'reactnative',
],
},
},
Config: {
apiId: 'W0ZHNMPI2O4KHJ48ZILZACRA',
apiKey: 'dummyApiKey',
eventDelivery: false,
eventDeliveryTS: 1602757086384,
region: 'US',
},
Enabled: true,
Transformations: [],
IsProcessorEnabled: true,
},
},
],
method: 'POST',
},
pathSuffix: '',
},
output: {
response: {
status: 200,
body: [
{
output: {
body: {
FORM: {},
JSON: {
attributes: {},
customer_id: 'userId16',
type: 'customer',
},
JSON_ARRAY: {},
XML: {},
},
endpoint: 'https://api-01.moengage.com/v1/customer/W0ZHNMPI2O4KHJ48ZILZACRA',
files: {},
headers: {
Authorization: 'Basic VzBaSE5NUEkyTzRLSEo0OFpJTFpBQ1JBOmR1bW15QXBpS2V5',
'Content-Type': 'application/json',
'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA',
},
method: 'POST',
params: {},
type: 'REST',
userId: 'anon-dummyId-1',
version: '1',
},
statusCode: 200,
},
],
},
},
},
];
Loading