Skip to content

Commit

Permalink
fix(mp incremental properties): add check for undefined properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia committed Sep 20, 2023
1 parent 22dc7b8 commit a7a925b
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 a7a925b

Please sign in to comment.