Skip to content

Commit

Permalink
fix(mixpanel incremental properties): add check for undefined propert…
Browse files Browse the repository at this point in the history
…ies (#2634)

fix(mp incremental properties): add check for undefined properties
  • Loading branch information
Gauravudia authored Sep 20, 2023
1 parent 22dc7b8 commit f267aa3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/v0/destinations/mp/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ const processIncrementalProperties = (message, destination, propIncrements) => {
payload.$distinct_id = message.userId || `$device:${message.anonymousId}`;
}

Object.keys(message.properties).forEach((prop) => {
const value = message.properties[prop];
if (value && propIncrements.includes(prop)) {
payload.$add[prop] = value;
}
});
if (message.properties) {
Object.keys(message.properties).forEach((prop) => {
const value = message.properties[prop];
if (value && propIncrements.includes(prop)) {
payload.$add[prop] = value;
}
});
}

return Object.keys(payload.$add).length > 0
? responseBuilderSimple(payload, message, 'incremental_properties', destination.Config)
Expand Down

0 comments on commit f267aa3

Please sign in to comment.