Skip to content

Commit

Permalink
chore(release): pull main into develop post release v1.90.2 (#4065)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayteki95 authored Feb 11, 2025
2 parents 72978c6 + 69a1d6b commit 27c9a35
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-hotfix-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

# Only allow these users to create new hotfix branch from 'main'
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc')
if: github.ref == 'refs/heads/main' && (github.actor == 'vinayteki95' || github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc' || github.triggering_actor == 'vinayteki95')
steps:
- name: Create Branch
uses: peterjgrainger/[email protected]
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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.90.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.90.1...v1.90.2) (2025-02-11)


### Bug Fixes

* better error handling in webhook v2 ([9f224ec](https://github.com/rudderlabs/rudder-transformer/commit/9f224ec03b91f1a4d85b117dbf6972bb1ef40c6d))
* improve error handling for webhook v2 ([f44d5a5](https://github.com/rudderlabs/rudder-transformer/commit/f44d5a56fd6ee183aea73eaba7e73c121f8bc470))
* improve error handling for webhook v2 ([#4061](https://github.com/rudderlabs/rudder-transformer/issues/4061)) ([5d1e1bd](https://github.com/rudderlabs/rudder-transformer/commit/5d1e1bdb26bacddb3838bd16752b333d7814c294))
* improve error handling for webhook v2 ([#4062](https://github.com/rudderlabs/rudder-transformer/issues/4062)) ([d795830](https://github.com/rudderlabs/rudder-transformer/commit/d79583087e98d713afb9b38d3a25d4e580a36c76))

### [1.90.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.90.0...v1.90.1) (2025-02-06)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.90.1",
"version": "1.90.2",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
5 changes: 5 additions & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const HTTP_CUSTOM_STATUS_CODES = {
FILTERED: 298,
};

const ErrorMessages = {
JSONParseError: 'Malformed JSON in request body',
};

module.exports = {
EventType,
GENERIC_TRUE_VALUES,
Expand All @@ -64,4 +68,5 @@ module.exports = {
TraitsMapping,
WhiteListedTraits,
HTTP_CUSTOM_STATUS_CODES,
ErrorMessages,
};
35 changes: 25 additions & 10 deletions src/controllers/util/conversionStrategies/strategyV2ToV0.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
import { TransformationError } from '@rudderstack/integrations-lib';
import { SourceInputConversionResult, SourceInputV2 } from '../../../types';
import { VersionConversionStrategy } from './abstractions';
import { ErrorMessages } from '../../../constants';

export class StrategyV2ToV0 extends VersionConversionStrategy<SourceInputV2, NonNullable<unknown>> {
convert(sourceEvents: SourceInputV2[]): SourceInputConversionResult<NonNullable<unknown>>[] {
return sourceEvents.map((sourceEvent) => {
try {
const v0Event = JSON.parse(sourceEvent.request.body);
return { output: v0Event };
} catch (err) {
const conversionError =
err instanceof Error ? err : new Error('error converting v2 to v0 spec');
return { conversionError };
}
});
return sourceEvents.map((sourceEvent) => this.convertSingleEvent(sourceEvent));
}

private convertSingleEvent(
sourceEvent: SourceInputV2,
): SourceInputConversionResult<NonNullable<unknown>> {
try {
const v0Event = this.parseRequestBody(sourceEvent.request.body);
return { output: v0Event };
} catch (err) {
const conversionError =
err instanceof TransformationError ? err : new Error('error converting v2 to v0 spec');

return { conversionError };
}
}

private parseRequestBody(body: string): NonNullable<unknown> {
try {
return JSON.parse(body);
} catch (err) {
throw new TransformationError(ErrorMessages.JSONParseError);
}
}
}
34 changes: 24 additions & 10 deletions src/controllers/util/conversionStrategies/strategyV2ToV1.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import { TransformationError } from '@rudderstack/integrations-lib';
import { SourceInput, SourceInputConversionResult, SourceInputV2 } from '../../../types';
import { VersionConversionStrategy } from './abstractions';

export class StrategyV2ToV1 extends VersionConversionStrategy<SourceInputV2, SourceInput> {
convert(sourceEvents: SourceInputV2[]): SourceInputConversionResult<SourceInput>[] {
return sourceEvents.map((sourceEvent) => {
try {
const v1Event = { event: JSON.parse(sourceEvent.request.body), source: sourceEvent.source };
return { output: v1Event };
} catch (err) {
const conversionError =
err instanceof Error ? err : new Error('error converting v2 to v1 spec');
return { conversionError };
}
});
return sourceEvents.map((sourceEvent) => this.convertSingleEvent(sourceEvent));
}

private convertSingleEvent(sourceEvent: SourceInputV2): SourceInputConversionResult<SourceInput> {
try {
const v1Event = {
event: this.parseRequestBody(sourceEvent.request.body),
source: sourceEvent.source,
};
return { output: v1Event };
} catch (err) {
const conversionError =
err instanceof TransformationError ? err : new Error('error converting v2 to v1 spec');
return { conversionError };
}
}

private parseRequestBody(body: string): NonNullable<unknown> {
try {
return JSON.parse(body);
} catch (err) {
throw new TransformationError('Malformed JSON in request body');
}
}
}
6 changes: 4 additions & 2 deletions src/controllers/util/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TransformationError } from '@rudderstack/integrations-lib';
import { ErrorMessages } from '../../constants';
import {
Destination,
Metadata,
Expand Down Expand Up @@ -222,7 +224,7 @@ describe('adaptInputToVersion', () => {
implementationVersion: 'v0',
input: [
{
conversionError: new SyntaxError('Unexpected end of JSON input'),
conversionError: new TransformationError(ErrorMessages.JSONParseError),
},
],
};
Expand Down Expand Up @@ -321,7 +323,7 @@ describe('adaptInputToVersion', () => {
implementationVersion: 'v1',
input: [
{
conversionError: new SyntaxError('Unexpected end of JSON input'),
conversionError: new TransformationError(ErrorMessages.JSONParseError),
},
],
};
Expand Down
6 changes: 4 additions & 2 deletions src/services/source/nativeIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FetchHandler } from '../../helpers/fetchHandlers';
import { SourceService } from '../../interfaces/SourceService';
import {
ErrorDetailer,
ErrorDetailerOptions,
MetaTransferObject,
RudderMessage,
SourceInputConversionResult,
Expand All @@ -15,13 +16,14 @@ import { SourcePostTransformationService } from './postTransformation';
import logger from '../../logger';

export class NativeIntegrationSourceService implements SourceService {
public getTags(): MetaTransferObject {
public getTags(extraErrorDetails: ErrorDetailerOptions = {}): MetaTransferObject {
const metaTO = {
errorDetails: {
module: tags.MODULES.SOURCE,
implementation: tags.IMPLEMENTATIONS.NATIVE,
destinationId: 'Non determinable',
workspaceId: 'Non determinable',
...extraErrorDetails,
} as ErrorDetailer,
errorContext: '[Native Integration Service] Failure During Source Transform',
} as MetaTransferObject;
Expand All @@ -36,7 +38,7 @@ export class NativeIntegrationSourceService implements SourceService {
_requestMetadata: NonNullable<unknown>,
): Promise<SourceTransformationResponse[]> {
const sourceHandler = FetchHandler.getSourceHandler(sourceType, version);
const metaTO = this.getTags();
const metaTO = this.getTags({ srcType: sourceType });
const respList: SourceTransformationResponse[] = await Promise.all<FixMe>(
sourceEvents.map(async (sourceEvent) => {
try {
Expand Down
4 changes: 4 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ type ErrorDetailer = {
module: string;
implementation: string;
feature: string;
} & ErrorDetailerOptions;

type ErrorDetailerOptions = {
errorCategory?: string;
errorType?: string;
meta?: string;
Expand Down Expand Up @@ -390,6 +393,7 @@ export {
Connection,
Destination,
ErrorDetailer,
ErrorDetailerOptions,
MessageIdMetadataMap,
MetaTransferObject,
Metadata,
Expand Down
2 changes: 2 additions & 0 deletions test/integrations/sources/adjust/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'adjust',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down Expand Up @@ -176,6 +177,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'adjust',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down
1 change: 1 addition & 0 deletions test/integrations/sources/appsflyer/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'appsflyer',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down
2 changes: 2 additions & 0 deletions test/integrations/sources/canny/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'canny',
workspaceId: 'Non determinable',
},
},
Expand Down Expand Up @@ -1650,6 +1651,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'canny',
workspaceId: 'Non determinable',
},
},
Expand Down
1 change: 1 addition & 0 deletions test/integrations/sources/gainsightpx/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'gainsightpx',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down
2 changes: 2 additions & 0 deletions test/integrations/sources/iterable/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'iterable',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down Expand Up @@ -145,6 +146,7 @@ export const data = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'iterable',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down
3 changes: 3 additions & 0 deletions test/integrations/sources/shopify/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const serverSideEventsScenarios = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'shopify',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down Expand Up @@ -104,6 +105,7 @@ const serverSideEventsScenarios = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'shopify',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down Expand Up @@ -148,6 +150,7 @@ const serverSideEventsScenarios = [
errorCategory: 'transformation',
implementation: 'native',
module: 'source',
srcType: 'shopify',
workspaceId: 'Non determinable',
},
statusCode: 400,
Expand Down

0 comments on commit 27c9a35

Please sign in to comment.