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 error for emarsys track call #3428

Merged
merged 1 commit into from
May 30, 2024
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/cdk/v2/destinations/emarsys/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const deduceEventId = (message, destConfig) => {
const { eventsMapping } = destConfig;
const { event } = message;
validateEventName(event);
if (eventsMapping.length > 0) {
if (Array.isArray(eventsMapping) && eventsMapping.length > 0) {
const keyMap = getHashFromArray(eventsMapping, 'from', 'to', false);
eventId = keyMap[event];
}
Expand Down
117 changes: 117 additions & 0 deletions test/integrations/destinations/emarsys/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1377,4 +1377,121 @@ export const data = [
},
},
},
{
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
name: 'emarsys',
description: 'Test 11 : Track call with no event mapping field should fail',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
metadata: {},
message: {
event: 'Order Completed',
anonymousId: 'anonId06',
channel: 'web',
context: {
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36',
traits: {
email: '[email protected]',
lastName: 'Doe',
firstName: 'John',
},
},
integrations: {
All: true,
EMARSYS: {
trigger_id: 'EVENT_TRIGGER_ID',
},
},
properties: {
company: 'testComp',
data: {
section_group1: [
{
section_variable1: 'some_value',
section_variable2: 'another_value',
},
{
section_variable1: 'yet_another_value',
section_variable2: 'one_more_value',
},
],
global: {
global_variable1: 'global_value',
global_variable2: 'another_global_value',
},
},
attachment: [
{
filename: 'example.pdf',
data: 'ZXhhbXBsZQo=',
},
],
},
messageId: '2536eda4-d638-4c93-8014-8ffe3f083214',
originalTimestamp: '2020-01-24T06:29:02.362Z',
receivedAt: '2020-01-24T11:59:02.403+05:30',
request_ip: '[::1]:53709',
sentAt: '2020-01-24T06:29:02.363Z',
timestamp: '2023-07-06T11:59:02.402+05:30',
type: 'track',
userId: 'userId06',
},
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
excludeKeys: [],
includeKeys: [],
},
},
Config: {
discardEmptyProperties: true,
emersysUsername: 'dummy',
emersysUserSecret: 'dummy',
emersysCustomIdentifier: '3',
defaultContactList: 'dummy',
fieldMapping: [
{
rudderProperty: 'email',
emersysProperty: '3',
},
],
oneTrustCookieCategories: [
{
oneTrustCookieCategory: 'Marketing',
},
],
},
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
error:
'Order Completed is not mapped to any Emersys external event. Aborting: Workflow: procWorkflow, Step: preparePayloadForTrack, ChildStep: undefined, OriginalError: Order Completed is not mapped to any Emersys external event. Aborting',
metadata: {},
statTags: {
destType: 'EMARSYS',
errorCategory: 'dataValidation',
errorType: 'configuration',
feature: 'processor',
implementation: 'cdkV2',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
].map((d) => ({ ...d, mockFns }));
Loading