Skip to content

Commit

Permalink
chore: allowing message with undefined event
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Jan 16, 2024
1 parent a7a7c60 commit 13dd5ff
Show file tree
Hide file tree
Showing 2 changed files with 2,646 additions and 2,541 deletions.
7 changes: 4 additions & 3 deletions src/v0/destinations/klaviyo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const {
handleRtTfSingleEventError,
flattenJson,
isNewStatusCodesAccepted,
validateEventName,
} = require('../../util');
const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant');

Expand Down Expand Up @@ -157,8 +156,10 @@ const trackRequestHandler = (message, category, destination) => {
const payload = {};
const { privateApiKey, flattenProperties } = destination.Config;
let event = get(message, 'event');
validateEventName(event);
event = event.trim().toLowerCase();
if (typeof event !== 'undefined' && typeof event !== 'string') {
throw new InstrumentationError('Event type should be a string or undefined');
}
event = event ? event.trim().toLowerCase() : event;
let attributes = {};
if (ecomEvents.includes(event) && message.properties) {
const eventName = eventNameMapping[event];
Expand Down
Loading

0 comments on commit 13dd5ff

Please sign in to comment.