diff --git a/src/controllers/util/conversionStrategies/strategyV1ToV2.ts b/src/controllers/util/conversionStrategies/strategyV1ToV2.ts index b4f04ef858..7cf4e77808 100644 --- a/src/controllers/util/conversionStrategies/strategyV1ToV2.ts +++ b/src/controllers/util/conversionStrategies/strategyV1ToV2.ts @@ -35,7 +35,7 @@ export class StrategyV1ToV2 extends VersionConversionStrategy, conversionError }; + return { conversionError }; } }); } diff --git a/src/controllers/util/conversionStrategies/strategyV2ToV1.ts b/src/controllers/util/conversionStrategies/strategyV2ToV1.ts index d651917096..52cade0d9d 100644 --- a/src/controllers/util/conversionStrategies/strategyV2ToV1.ts +++ b/src/controllers/util/conversionStrategies/strategyV2ToV1.ts @@ -10,7 +10,7 @@ export class StrategyV2ToV1 extends VersionConversionStrategy { implementationVersion: 'v0', input: [ { - output: {}, conversionError: new SyntaxError('Unexpected end of JSON input'), }, ], @@ -322,7 +321,6 @@ describe('adaptInputToVersion', () => { implementationVersion: 'v1', input: [ { - output: {}, conversionError: new SyntaxError('Unexpected end of JSON input'), }, ], diff --git a/src/services/source/nativeIntegration.ts b/src/services/source/nativeIntegration.ts index 58a6a19649..078716df96 100644 --- a/src/services/source/nativeIntegration.ts +++ b/src/services/source/nativeIntegration.ts @@ -53,12 +53,25 @@ export class NativeIntegrationSourceService implements SourceService { metaTO, ); } - const newSourceEvent = sourceEvent.output; - const { headers } = newSourceEvent; - delete newSourceEvent.headers; - const respEvents: RudderMessage | RudderMessage[] | SourceTransformationResponse = - await sourceHandler.process(newSourceEvent); - return SourcePostTransformationService.handleSuccessEventsSource(respEvents, { headers }); + + if (sourceEvent.output) { + const newSourceEvent = sourceEvent.output; + + const { headers } = newSourceEvent; + if (headers) { + delete newSourceEvent.headers; + } + + const respEvents: RudderMessage | RudderMessage[] | SourceTransformationResponse = + await sourceHandler.process(newSourceEvent); + return SourcePostTransformationService.handleSuccessEventsSource(respEvents, { + headers, + }); + } + return SourcePostTransformationService.handleFailureEventsSource( + new Error('Error post version converstion, converstion output is undefined'), + metaTO, + ); } catch (error: FixMe) { stats.increment('source_transform_errors', { source: sourceType, diff --git a/src/types/index.ts b/src/types/index.ts index ee225bb0c0..7c07f659df 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -374,7 +374,7 @@ type SourceInputV2 = { }; type SourceInputConversionResult = { - output: T; + output?: T; conversionError?: Error; };