diff --git a/src/cdk/v2/destinations/algolia/procWorkflow.yaml b/src/cdk/v2/destinations/algolia/procWorkflow.yaml index 70161cc2ca..f13777a40e 100644 --- a/src/cdk/v2/destinations/algolia/procWorkflow.yaml +++ b/src/cdk/v2/destinations/algolia/procWorkflow.yaml @@ -26,8 +26,11 @@ steps: $.assert(.message.properties.index, 'Missing required value from "properties.index"'); let eventTypeMap = $.eventTypeMapping(.destination.Config); let event = .message.event.trim().toLowerCase(); - let eventType = .message.properties?.eventType ?? eventTypeMap[event]; - let eventSubType = .message.properties?.eventSubtype in $.ALLOWED_EVENT_SUBTYPES && eventType === 'conversion' ? .message.properties.eventSubtype: null; + let eventType = .message.properties.eventType ?? eventTypeMap[event]; + let eventSubType = .message.properties.eventSubtype && eventType === 'conversion' ? + .message.properties.eventSubtype in $.ALLOWED_EVENT_SUBTYPES ? + .message.properties.eventSubtype : null + : null; $.assert(eventType, "eventType is mandatory for track call"); let payload = .message.().({ index: .properties.index,