diff --git a/CHANGELOG.md b/CHANGELOG.md index 01631435d2..b9256fa915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.49.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.48.0...v1.49.0) (2023-11-06) + + +### Features + +* add new destination tiktok_audience ([#2710](https://github.com/rudderlabs/rudder-transformer/issues/2710)) ([9bc0fd8](https://github.com/rudderlabs/rudder-transformer/commit/9bc0fd8efcee44871a190bd6cb9e89c5cf035ff8)) +* onboard one signal to router transform ([#2785](https://github.com/rudderlabs/rudder-transformer/issues/2785)) ([818858e](https://github.com/rudderlabs/rudder-transformer/commit/818858e046ce5f9735bbb97715c43a959ad3aa3c)) +* onboard revenuecat as a source ([#2774](https://github.com/rudderlabs/rudder-transformer/issues/2774)) ([55f9637](https://github.com/rudderlabs/rudder-transformer/commit/55f96374b4d73db7013c1d5e72bfc9c8257b224b)) + + +### Bug Fixes + +* add check to remove null and undefined properties before sending ([#2796](https://github.com/rudderlabs/rudder-transformer/issues/2796)) ([6e89cd3](https://github.com/rudderlabs/rudder-transformer/commit/6e89cd3f67ea887ba17c1cd5ffbca6675f54d96c)) +* allow support for full url from UI in freshsales and freshmarketer ([#2780](https://github.com/rudderlabs/rudder-transformer/issues/2780)) ([570532c](https://github.com/rudderlabs/rudder-transformer/commit/570532ce790c05a69621d9289758a1b1a7acda8c)) +* busgnag issues for klaviyo, freshsales, customeio ([#2795](https://github.com/rudderlabs/rudder-transformer/issues/2795)) ([11fb7c4](https://github.com/rudderlabs/rudder-transformer/commit/11fb7c47910681833e37d25a1573d2005e62742b)) + ## [1.48.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.47.0...v1.48.0) (2023-11-02) diff --git a/package-lock.json b/package-lock.json index 0822a9b42b..c16855ccfd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.48.0", + "version": "1.49.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.48.0", + "version": "1.49.0", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "^0.7.24", @@ -23,10 +23,10 @@ "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", - "axios": "^1.4.0", + "axios": "^1.6.0", "btoa": "^1.2.1", "component-each": "^0.2.6", - "crypto-js": "^4.1.1", + "crypto-js": "^4.2.0", "dotenv": "^16.0.3", "flat": "^5.0.2", "form-data": "^4.0.0", @@ -8171,8 +8171,9 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.4.0", - "license": "MIT", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -10608,8 +10609,9 @@ } }, "node_modules/crypto-js": { - "version": "4.1.1", - "license": "MIT" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "node_modules/currently-unhandled": { "version": "0.4.1", diff --git a/package.json b/package.json index 46f728664d..f0746c9aaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.48.0", + "version": "1.49.0", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { @@ -67,10 +67,10 @@ "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", - "axios": "^1.4.0", + "axios": "^1.6.0", "btoa": "^1.2.1", "component-each": "^0.2.6", - "crypto-js": "^4.1.1", + "crypto-js": "^4.2.0", "dotenv": "^16.0.3", "flat": "^5.0.2", "form-data": "^4.0.0", diff --git a/src/legacy/router.js b/src/legacy/router.js index a8c2b49a1a..99fb8570fb 100644 --- a/src/legacy/router.js +++ b/src/legacy/router.js @@ -571,14 +571,9 @@ if (startDestTransformer) { destEvents.length > 0 && destEvents[0].metadata ? getMetadata(destEvents[0].metadata) : {}; - const userFuncStartTime = new Date(); if (transformationVersionId) { let destTransformedEvents; try { - stats.counter('user_transform_function_input_events', destEvents.length, { - processSessions, - ...metaTags, - }); destTransformedEvents = await userTransformHandler()( destEvents, transformationVersionId, @@ -630,12 +625,6 @@ if (startDestTransformer) { processSessions, ...metaTags, }); - } finally { - stats.timing('user_transform_function_latency', userFuncStartTime, { - transformationVersionId, - processSessions, - ...metaTags, - }); } } else { const errorMessage = 'Transformation VersionID not found'; diff --git a/src/services/userTransform.ts b/src/services/userTransform.ts index 18165615a8..4fe1ad0b52 100644 --- a/src/services/userTransform.ts +++ b/src/services/userTransform.ts @@ -85,9 +85,6 @@ export default class UserTransformService { } const userFuncStartTime = new Date(); try { - stats.counter('user_transform_function_input_events', eventsToProcess.length, { - ...metaTags, - }); const destTransformedEvents: UserTransformationResponse[] = await userTransformHandler()( eventsToProcess, transformationVersionId, diff --git a/src/util/customTransformer-faas.js b/src/util/customTransformer-faas.js index 54d2410313..2c0bbfd8c0 100644 --- a/src/util/customTransformer-faas.js +++ b/src/util/customTransformer-faas.js @@ -24,8 +24,8 @@ function generateFunctionName(userTransformation, libraryVersionIds, testMode) { const ids = [userTransformation.workspaceId, userTransformation.versionId].concat( (libraryVersionIds || []).sort(), ); - const hash = crypto.createHash('md5').update(`${ids}`).digest('hex'); + const hash = crypto.createHash('md5').update(`${ids}`).digest('hex'); return `fn-${userTransformation.workspaceId}-${hash}`.substring(0, 63).toLowerCase(); } @@ -127,15 +127,8 @@ async function runOpenFaasUserTransform( if (events.length === 0) { throw new Error('Invalid payload. No events'); } - const metaTags = events[0].metadata ? getMetadata(events[0].metadata) : {}; - const tags = { - transformerVersionId: userTransformation.versionId, - identifier: 'openfaas', - testMode, - ...metaTags, - }; - const trMetadata = events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}; + const trMetadata = events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}; // check and deploy faas function if not exists const functionName = generateFunctionName(userTransformation, libraryVersionIds, testMode); if (testMode) { @@ -148,9 +141,7 @@ async function runOpenFaasUserTransform( ); } - const invokeTime = new Date(); - stats.counter('events_to_process', events.length, tags); - const result = await executeFaasFunction( + return await executeFaasFunction( functionName, events, userTransformation.versionId, @@ -165,8 +156,6 @@ async function runOpenFaasUserTransform( testMode, trMetadata, ); - stats.timing('run_time', invokeTime, tags); - return result; } module.exports = { diff --git a/src/util/customTransformer-v1.js b/src/util/customTransformer-v1.js index 397281d8d9..60f8e493fa 100644 --- a/src/util/customTransformer-v1.js +++ b/src/util/customTransformer-v1.js @@ -1,7 +1,7 @@ const ivm = require('isolated-vm'); const { getFactory } = require('./ivmFactory'); -const { getMetadata } = require('../v0/util'); +const { getMetadata, getTransformationMetadata } = require('../v0/util'); const logger = require('../logger'); const stats = require('./stats'); @@ -54,63 +54,48 @@ async function userTransformHandlerV1( libraryVersionIds, testMode = false, ) { - /* - Removing pool usage to address memory leaks - Env variable ON_DEMAND_ISOLATE_VM is not being used anymore - */ - if (userTransformation.versionId) { - const metaTags = events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}; - const tags = { - transformerVersionId: userTransformation.versionId, - identifier: 'v1', - ...metaTags, - }; - - logger.debug(`Isolate VM being created... `); - const isolatevmFactory = await getFactory( - userTransformation.code, - libraryVersionIds, - userTransformation.versionId, - userTransformation.secrets || {}, - testMode, - ); - const isolatevm = await isolatevmFactory.create(); - logger.debug(`Isolate VM created... `); + if (!userTransformation.versionId) { + return { transformedEvents : events }; + } - // Transform the event... - stats.counter('events_to_process', events.length, tags); - const isolateStartWallTime = calculateMsFromIvmTime(isolatevm.isolateStartWallTime); - const isolateStartCPUTime = calculateMsFromIvmTime(isolatevm.isolateStartCPUTime); + const isolatevmFactory = await getFactory( + userTransformation.code, + libraryVersionIds, + userTransformation.versionId, + userTransformation.secrets || {}, + testMode, + ); - const invokeTime = new Date(); - let transformedEvents; - // Destroy isolatevm in case of execution errors - try { - transformedEvents = await transform(isolatevm, events); - } catch (err) { - logger.error(`Error encountered while executing transformation: ${err.message}`); - isolatevmFactory.destroy(isolatevm); - throw err; - } - const { logs } = isolatevm; - stats.timing('run_time', invokeTime, tags); - const isolateEndWallTime = calculateMsFromIvmTime(isolatevm.isolate.wallTime); - const isolateEndCPUTime = calculateMsFromIvmTime(isolatevm.isolate.cpuTime); + logger.debug(`Creating IsolateVM`); + const isolatevm = await isolatevmFactory.create(); - //TODO: fix "Value is not a valid number: NaN" error and uncomment - //stats.timing('isolate_wall_time', isolateEndWallTime - isolateStartWallTime, tags); - //stats.timing('isolate_cpu_time', isolateEndCPUTime - isolateStartCPUTime, tags); + const invokeTime = new Date(); + let transformedEvents; + let logs; + let transformationError; - // Destroy the isolated vm resources created - logger.debug(`Isolate VM being destroyed... `); + try { + transformedEvents = await transform(isolatevm, events); + logs = isolatevm.logs; + } catch (err) { + logger.error(`Error encountered while executing transformation: ${err.message}`); + transformationError = err; + throw err; + } finally { + logger.debug(`Destroying IsolateVM`); isolatevmFactory.destroy(isolatevm); - logger.debug(`Isolate VM destroyed... `); - - return { transformedEvents, logs }; - // Events contain message and destination. We take the message part of event and run transformation on it. - // And put back the destination after transforrmation + // send the observability stats + const tags = { + identifier: 'v1', + errored: transformationError ? true : false, + ...events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}, + ...events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {} + } + stats.counter('user_transform_function_input_events', events.length, tags); + stats.timing('user_transform_function_latency', invokeTime, tags); } - return { transformedEvents: events }; + + return { transformedEvents, logs }; } async function setUserTransformHandlerV1() { diff --git a/src/util/customTransformer.js b/src/util/customTransformer.js index 90dcea61b2..001fe3216c 100644 --- a/src/util/customTransformer.js +++ b/src/util/customTransformer.js @@ -7,6 +7,7 @@ const { UserTransformHandlerFactory } = require('./customTransformerFactory'); const { parserForImport } = require('./parser'); const stats = require('./stats'); const { fetchWithDnsWrapper } = require('./utils'); +const { getMetadata, getTransformationMetadata } = require('../v0/util'); const ISOLATE_VM_MEMORY = parseInt(process.env.ISOLATE_VM_MEMORY || '128', 10); const GEOLOCATION_TIMEOUT_IN_MS = parseInt(process.env.GEOLOCATION_TIMEOUT_IN_MS || '1000', 10); @@ -19,10 +20,6 @@ async function runUserTransform( versionId, testMode = false, ) { - const tags = { - transformerVersionId: versionId, - identifier: 'v0', - }; // TODO: Decide on the right value for memory limit const isolate = new ivm.Isolate({ memoryLimit: ISOLATE_VM_MEMORY }); const context = await isolate.createContext(); @@ -214,9 +211,6 @@ async function runUserTransform( const customScript = await isolate.compileScript(`${code}`); await customScript.run(context); const fnRef = await jail.get('transform', { reference: true }); - // stat - stats.counter('events_to_process', events.length, tags); - // TODO : check if we can resolve this // eslint-disable-next-line no-async-promise-executor const executionPromise = new Promise(async (resolve, reject) => { const sharedMessagesList = new ivm.ExternalCopy(events).copyInto({ @@ -233,6 +227,7 @@ async function runUserTransform( } }); let result; + let transformationError; const invokeTime = new Date(); try { const timeoutPromise = new Promise((resolve) => { @@ -245,8 +240,8 @@ async function runUserTransform( if (result === 'Timedout') { throw new Error('Timed out'); } - stats.timing('run_time', invokeTime, tags); } catch (error) { + transformationError = error; throw error; } finally { // release function, script, context and isolate @@ -255,6 +250,16 @@ async function runUserTransform( bootstrapScriptResult.release(); context.release(); isolate.dispose(); + + const tags = { + identifier: 'v0', + errored: transformationError ? true : false, + ...events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}, + ...events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {} + } + + stats.counter('user_transform_function_input_events', events.length, tags); + stats.timing('user_transform_function_latency', invokeTime, tags); } return { diff --git a/src/util/customTransformerFactory.js b/src/util/customTransformerFactory.js index 66268db286..1bf10e5d45 100644 --- a/src/util/customTransformerFactory.js +++ b/src/util/customTransformerFactory.js @@ -1,9 +1,15 @@ -const { setOpenFaasUserTransform, runOpenFaasUserTransform } = require('./customTransformer-faas'); +const { + setOpenFaasUserTransform, + runOpenFaasUserTransform, +} = require('./customTransformer-faas'); -const { userTransformHandlerV1, setUserTransformHandlerV1 } = require('./customTransformer-v1'); +const { + userTransformHandlerV1, + setUserTransformHandlerV1, +} = require('./customTransformer-v1'); const UserTransformHandlerFactory = (userTransformation) => { - const transformHandler = { + return { setUserTransform: async (libraryVersionIds) => { switch (userTransformation.language) { case 'pythonfaas': @@ -17,13 +23,23 @@ const UserTransformHandlerFactory = (userTransformation) => { switch (userTransformation.language) { case 'pythonfaas': case 'python': - return runOpenFaasUserTransform(events, userTransformation, libraryVersionIds, testMode); + return runOpenFaasUserTransform( + events, + userTransformation, + libraryVersionIds, + testMode + ); + default: - return userTransformHandlerV1(events, userTransformation, libraryVersionIds, testMode); + return userTransformHandlerV1( + events, + userTransformation, + libraryVersionIds, + testMode + ); } }, }; - return transformHandler; }; exports.UserTransformHandlerFactory = UserTransformHandlerFactory; diff --git a/src/util/openfaas/index.js b/src/util/openfaas/index.js index f80aa01c23..47a69aeb18 100644 --- a/src/util/openfaas/index.js +++ b/src/util/openfaas/index.js @@ -1,6 +1,5 @@ const NodeCache = require('node-cache'); const { - getFunction, deleteFunction, deployFunction, invokeFunction, @@ -8,6 +7,9 @@ const { } = require('./faasApi'); const logger = require('../../logger'); const { RetryRequestError, RespStatusError } = require('../utils'); +const stats = require('../stats'); +const { getMetadata, getTransformationMetadata } = require('../../v0/util'); +const { HTTP_STATUS_CODES } = require('../../v0/util/constant'); const FAAS_BASE_IMG = process.env.FAAS_BASE_IMG || 'rudderlabs/openfaas-flask:main'; const FAAS_MAX_PODS_IN_TEXT = process.env.FAAS_MAX_PODS_IN_TEXT || '40'; @@ -230,41 +232,44 @@ async function setupFaasFunction( } const executeFaasFunction = async ( - functionName, + name, events, versionId, libraryVersionIDs, testMode, trMetadata = {}, ) => { - try { - logger.debug('[Faas] Invoking faas function'); + logger.debug(`Executing faas function: ${name}`); - if (testMode) await awaitFunctionReadiness(functionName); + const startTime = new Date(); + let errorRaised; + + try { + if (testMode) await awaitFunctionReadiness(name); + return await invokeFunction(name, events); - const res = await invokeFunction(functionName, events); - logger.debug('[Faas] Invoked faas function'); - return res; } catch (error) { - logger.error(`[Faas] Error while invoking ${functionName}: ${error.message}`); + logger.error(`Error while invoking ${name}: ${error.message}`); + errorRaised = error; + if ( error.statusCode === 404 && - error.message.includes(`error finding function ${functionName}`) + error.message.includes(`error finding function ${name}`) ) { - removeFunctionFromCache(functionName); + removeFunctionFromCache(name); await setupFaasFunction( - functionName, + name, null, versionId, libraryVersionIDs, testMode, trMetadata, ); - throw new RetryRequestError(`${functionName} not found`); + throw new RetryRequestError(`${name} not found`); } if (error.statusCode === 429) { - throw new RetryRequestError(`Rate limit exceeded for ${functionName}`); + throw new RetryRequestError(`Rate limit exceeded for ${name}`); } if (error.statusCode === 500 || error.statusCode === 503) { @@ -272,16 +277,29 @@ const executeFaasFunction = async ( } if (error.statusCode === 504) { - throw new RespStatusError('Timed out'); + throw new RespStatusError(`${name} timed out`); } throw error; } finally { + // delete the function created, if it's called as part of testMode if (testMode) { - deleteFunction(functionName).catch((err) => { - logger.error(`[Faas] Error while deleting ${functionName}: ${err.message}`); - }); + deleteFunction(name).catch((err) => + logger.error(`[Faas] Error while deleting ${name}: ${err.message}`)) + } + + // setup the tags for observability and then fire the stats + const tags = { + identifier: "openfaas", + testMode: testMode, + errored: errorRaised ? true : false, + statusCode: errorRaised ? errorRaised.statusCode : HTTP_STATUS_CODES.OK, // default statuscode is 200OK + ...events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}, + ...events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}, } + + stats.counter('user_transform_function_input_events', events.length, tags) + stats.timing('user_transform_function_latency', startTime, tags) } }; diff --git a/src/util/prometheus.js b/src/util/prometheus.js index 9f3255a05d..116f77d214 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -249,12 +249,6 @@ class Prometheus { type: 'counter', labelNames: ['processSessions'], }, - { - name: 'user_transform_function_input_events', - help: 'user_transform_function_input_events', - type: 'counter', - labelNames: ['processSessions', 'sourceType', 'destinationType', 'k8_namespace'], - }, { name: 'user_transform_errors', help: 'user_transform_errors', @@ -505,20 +499,6 @@ class Prometheus { type: 'counter', labelNames: ['writeKey', 'source'], }, - { - name: 'events_to_process', - help: 'events_to_process', - type: 'counter', - labelNames: [ - 'transformerVersionId', - 'language', - 'identifier', - 'testMode', - 'sourceType', - 'destinationType', - 'k8_namespace', - ], - }, { name: 'get_transformation_code', help: 'get_transformation_code', @@ -668,21 +648,6 @@ class Prometheus { type: 'histogram', labelNames: ['transformerVersionId', 'language', 'identifier', 'publish', 'testMode'], }, - { - name: 'run_time', - help: 'run_time', - type: 'histogram', - labelNames: [ - 'transformerVersionId', - 'language', - 'identifier', - 'publish', - 'testMode', - 'sourceType', - 'destinationType', - 'k8_namespace', - ], - }, { name: 'get_tracking_plan', help: 'get_tracking_plan', type: 'histogram', labelNames: [] }, { name: 'createivm_duration', help: 'createivm_duration', type: 'histogram', labelNames: [] }, { @@ -940,6 +905,38 @@ class Prometheus { type: 'histogram', labelNames: [], }, + { + name: 'user_transform_function_input_events', + help: 'user_transform_function_input_events', + type: 'counter', + labelNames: [ + 'identifier', + 'testMode', + 'sourceType', + 'destinationType', + 'k8_namespace', + 'errored', + 'statusCode', + 'transformationId', + 'workspaceId' + ], + }, + { + name: 'user_transform_function_latency', + help: 'user_transform_function_latency', + type: 'histogram', + labelNames: [ + 'identifier', + 'testMode', + 'sourceType', + 'destinationType', + 'k8_namespace', + 'errored', + 'statusCode', + 'transformationId', + 'workspaceId' + ], + } ]; metrics.forEach((metric) => { diff --git a/src/util/stats.js b/src/util/stats.js index de77362ac1..e57ab85731 100644 --- a/src/util/stats.js +++ b/src/util/stats.js @@ -11,14 +11,19 @@ function init() { return; } - if (statsClientType === 'statsd') { - statsClient = new statsd.Statsd(); - logger.info('created statsd client'); - } else if (statsClientType === 'prometheus') { - statsClient = new prometheus.Prometheus(); - logger.info('created prometheus client'); - } else { - logger.info("Invalid stats client type. Valid values are 'statsd' and 'prometheus'."); + switch (statsClientType) { + case 'statsd': + logger.info("setting up statsd client") + statsClient = new statsd.Statsd(); + break; + + case 'prometheus': + logger.info("setting up prometheus client") + statsClient = new prometheus.Prometheus(); + break; + + default: + logger.error(`invalid stats client type: ${statsClientType}, supported values are 'statsd' and 'prometheues'`) } } diff --git a/src/v0/destinations/am/transform.js b/src/v0/destinations/am/transform.js index b74625e273..04a1c5a107 100644 --- a/src/v0/destinations/am/transform.js +++ b/src/v0/destinations/am/transform.js @@ -196,7 +196,7 @@ const getScreenevTypeAndUpdatedProperties = (message, CATEGORY_KEY) => { const name = message.name || message.event || get(message, CATEGORY_KEY); const updatedName = name ? `${name} ` : ''; return { - evType: `Viewed ${updatedName}Screen`, + eventType: `Viewed ${updatedName}Screen`, updatedProperties: { ...message.properties, name, @@ -589,8 +589,7 @@ const processSingleMessage = (message, destination) => { // To be used for track/page calls to associate the event to a group in AM let groupInfo = get(message, 'integrations.Amplitude.groups') || undefined; let category = ConfigCategory.DEFAULT; - let { properties } = message; - const { name, event } = message; + const { name, event, properties } = message; const messageType = message.type.toLowerCase(); const CATEGORY_KEY = 'properties.category'; const { useUserDefinedPageEventName, userProvidedPageEventString } = destination.Config; @@ -623,18 +622,21 @@ const processSingleMessage = (message, destination) => { evType = `Viewed ${updatedName || ''}Page`; } message.properties = { - ...message.properties, + ...properties, name: name || get(message, CATEGORY_KEY), }; category = ConfigCategory.PAGE; break; case EventType.SCREEN: - ({ evType, updatedProperties: properties } = getScreenevTypeAndUpdatedProperties( - message, - CATEGORY_KEY, - )); - message.properties = properties; - category = ConfigCategory.SCREEN; + { + const { eventType, updatedProperties } = getScreenevTypeAndUpdatedProperties( + message, + CATEGORY_KEY, + ); + evType = eventType; + message.properties = updatedProperties; + category = ConfigCategory.SCREEN; + } break; case EventType.GROUP: evType = 'group'; @@ -664,9 +666,9 @@ const processSingleMessage = (message, destination) => { throw new InstrumentationError('Event not present. Please send event field'); } if ( - message.properties && - isDefinedAndNotNull(message.properties?.revenue) && - isDefinedAndNotNull(message.properties?.revenue_type) + properties && + isDefinedAndNotNull(properties?.revenue) && + isDefinedAndNotNull(properties?.revenue_type) ) { // if properties has revenue and revenue_type fields // consider the event as revenue event directly