Skip to content

Commit

Permalink
fix: bug fix for track event
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Nov 27, 2023
1 parent 9eda50e commit 46d3f1c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/v0/destinations/sfmc/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const {
NetworkError,
ConfigurationError,
InstrumentationError,
isDefinedAndNotNull,
isEmpty,
} = require('@rudderstack/integrations-lib');
const myAxios = require('../../../util/myAxios');
const { EventType } = require('../../../constants');
Expand All @@ -17,7 +19,6 @@ const {
flattenJson,
toTitleCase,
getHashFromArray,
isEmpty,
simpleProcessRouterDest,
} = require('../../util');
const {
Expand Down Expand Up @@ -224,7 +225,13 @@ const responseBuilderSimple = async (message, category, destination) => {
throw new ConfigurationError('Creating or updating contacts is disabled');
}

if (category.type === 'track' && hashMapExternalKey[message.event.toLowerCase()]) {
if (category.type === 'track') {
if (isEmpty(message.event)) {
throw new ConfigurationError('Event name is required for this track events');

Check warning on line 230 in src/v0/destinations/sfmc/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/sfmc/transform.js#L230

Added line #L230 was not covered by tests
}
if (!isDefinedAndNotNull(hashMapExternalKey[message.event.toLowerCase()])) {
throw new ConfigurationError('Event not mapped for this track call');
}
return responseBuilderForInsertData(
message,
hashMapExternalKey[message.event.toLowerCase()],
Expand All @@ -237,7 +244,7 @@ const responseBuilderSimple = async (message, category, destination) => {
);
}

throw new ConfigurationError('Event not mapped for this track call');
throw new ConfigurationError('Event type not supported');

Check warning on line 247 in src/v0/destinations/sfmc/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/sfmc/transform.js#L247

Added line #L247 was not covered by tests
};

const processEvent = async (message, destination) => {
Expand Down

0 comments on commit 46d3f1c

Please sign in to comment.