diff --git a/src/controllers/source.ts b/src/controllers/source.ts index 502b3adc1a..b1e7e8fe12 100644 --- a/src/controllers/source.ts +++ b/src/controllers/source.ts @@ -22,7 +22,7 @@ export default class SourceController { events, ); const resplist = await integrationService.sourceTransformRoutine( - input as NonNullable[], + input, source, implementationVersion, requestMetadata, diff --git a/src/controllers/util/index.ts b/src/controllers/util/index.ts index 0f685e32cb..c52eb6899e 100644 --- a/src/controllers/util/index.ts +++ b/src/controllers/util/index.ts @@ -29,7 +29,7 @@ export default class ControllerUtility { }; private static getSourceVersionsMap(): Map { - if (this.sourceVersionMap.size > 0) { + if (this.sourceVersionMap?.size > 0) { return this.sourceVersionMap; } const versions = ['v0', 'v1']; diff --git a/src/services/source/nativeIntegration.ts b/src/services/source/nativeIntegration.ts index d286dd555d..f29d68d054 100644 --- a/src/services/source/nativeIntegration.ts +++ b/src/services/source/nativeIntegration.ts @@ -5,6 +5,7 @@ import { RudderMessage, SourceTransformationResponse, } from '../../types/index'; +import { FixMe } from '../../util/types'; import PostTransformationServiceSource from './postTransformation'; import FetchHandler from '../../helpers/fetchHandlers'; import tags from '../../v0/util/tags'; @@ -24,23 +25,21 @@ export default class NativeIntegrationSourceService implements IntegrationSource return metaTO; } - public async sourceTransformRoutine( sourceEvents: NonNullable[], sourceType: string, version: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - _requestMetadata: object, + _requestMetadata: NonNullable, ): Promise { - - // Using version along with sourceType because if for a particular const sourceHandler = FetchHandler.getSourceHandler(sourceType, version); - const respList: SourceTransformationResponse[] = await Promise.all( + const respList: SourceTransformationResponse[] = await Promise.all( sourceEvents.map(async (sourceEvent) => { try { - const respEvents: RudderMessage | RudderMessage[] | SourceTransformationResponse = await sourceHandler.process(sourceEvent); + const respEvents: RudderMessage | RudderMessage[] | SourceTransformationResponse = + await sourceHandler.process(sourceEvent); return PostTransformationServiceSource.handleSuccessEventsSource(respEvents); - } catch (error: any) { + } catch (error: FixMe) { const metaTO = this.getTags(); stats.increment('source_transform_errors', { sourceType, diff --git a/test/apitests/data_scenarios/source/v1/failure.json b/test/apitests/data_scenarios/source/v1/failure.json index eaffe3e771..ef8db86b69 100644 --- a/test/apitests/data_scenarios/source/v1/failure.json +++ b/test/apitests/data_scenarios/source/v1/failure.json @@ -2,15 +2,9 @@ "input": [ { "query_parameters": { - "topic": [ - "random_event" - ], - "signature": [ - "rudderstack" - ], - "writeKey": [ - "sample-write-key" - ] + "topic": ["random_event"], + "signature": ["rudderstack"], + "writeKey": ["sample-write-key"] } } ], @@ -19,12 +13,8 @@ "statusCode": 500, "error": "Cannot find module '../undefined/sources/NA_SOURCE/transform' from 'src/services/misc.ts'", "statTags": { - "errorCategory": "transformation", - "module": "source", - "implementation": "native", - "destinationId": "Non determinable", - "workspaceId": "Non determinable" + "errorCategory": "transformation" } } ] -} \ No newline at end of file +}