Skip to content

Commit

Permalink
chore(release): pull hotfix-release/v1.75.1 into main (#3659)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpj2292 authored Aug 14, 2024
2 parents cb14429 + 932a296 commit 5471119
Show file tree
Hide file tree
Showing 16 changed files with 577 additions and 12 deletions.
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.75.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.75.0...v1.75.1) (2024-08-14)


### Bug Fixes

* add validation for concurrent_modification error ([#3654](https://github.com/rudderlabs/rudder-transformer/issues/3654)) ([62cdc46](https://github.com/rudderlabs/rudder-transformer/commit/62cdc4641d44d79e21949722660173df4c749f24))
* clevertap bugsnag issue ([#3656](https://github.com/rudderlabs/rudder-transformer/issues/3656)) ([6c51487](https://github.com/rudderlabs/rudder-transformer/commit/6c51487183b6b0b755620aac6cd51c2ffc966102))
* snapchat conversion bugsnag issue ([#3657](https://github.com/rudderlabs/rudder-transformer/issues/3657)) ([31b03fc](https://github.com/rudderlabs/rudder-transformer/commit/31b03fc022ace0cda8df798c50e4764a9703c23b))
* validation for iterable object of HS ([#3653](https://github.com/rudderlabs/rudder-transformer/issues/3653)) ([1cb3f86](https://github.com/rudderlabs/rudder-transformer/commit/1cb3f86c894f30bdf04df870484c6df3a956f36e))

## [1.75.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.74.1...v1.75.0) (2024-08-12)


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.75.0",
"version": "1.75.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/clevertap/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ const responseBuilderSimple = (message, category, destination) => {
// For 'Order Completed' type of events we are mapping it as 'Charged'
// Special event in Clevertap.
// Source: https://developer.clevertap.com/docs/concepts-events#recording-customer-purchases
if (get(message.event) && get(message.event).toLowerCase() === 'order completed') {
if (get(message.event) && get(message.event).toString().toLowerCase() === 'order completed') {
eventPayload = {
evtName: 'Charged',
evtData: constructPayload(message, MAPPING_CONFIG[CONFIG_CATEGORIES.ECOM.name]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { NetworkError } = require('@rudderstack/integrations-lib');
const get = require('get-value');
const { prepareProxyRequest, handleHttpRequest } = require('../../../adapters/network');
const { isHttpStatusSuccess } = require('../../util/index');

const {
processAxiosResponse,
getDynamicErrorType,
Expand Down Expand Up @@ -148,9 +148,15 @@ const gaAudienceProxyRequest = async (request) => {
};

const gaAudienceRespHandler = (destResponse, stageMsg) => {
const { status, response } = destResponse;
// const respAttributes = response["@attributes"] || null;
// const { stat, err_code: errorCode } = respAttributes;
let { status } = destResponse;
const { response } = destResponse;

if (
status === 400 &&
get(response, 'error.details.0.errors.0.errorCode.databaseError') === 'CONCURRENT_MODIFICATION'
) {
status = 500;
}

throw new NetworkError(
`${JSON.stringify(response)} ${stageMsg}`,
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/hs/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const processBatchRouter = async (inputs, reqMetadata) => {
errorRespList: tempInputs.map((input) =>
handleRtTfSingleEventError(input, error, reqMetadata),
),
dontBatchEvents: [],
};
}

Expand Down Expand Up @@ -192,7 +193,6 @@ const processRouterDest = async (inputs, reqMetadata) => {
batchedResponseList.push(...response.batchedResponseList);
dontBatchEvents.push(...response.dontBatchEvents);
});
console.log(JSON.stringify([...batchedResponseList, ...errorRespList, ...dontBatchEvents]));
return [...batchedResponseList, ...errorRespList, ...dontBatchEvents];
};

Expand Down
9 changes: 9 additions & 0 deletions src/v0/destinations/hs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,14 @@ const convertToResponseFormat = (successRespListWithDontBatchTrue) => {
return response;
};

const isIterable = (obj) => {
// checks for null and undefined
if (obj == null) {
return false;
}
return typeof obj[Symbol.iterator] === 'function';
};

module.exports = {
validateDestinationConfig,
addExternalIdToHSTraits,
Expand All @@ -895,4 +903,5 @@ module.exports = {
extractIDsForSearchAPI,
getRequestData,
convertToResponseFormat,
isIterable,
};
19 changes: 19 additions & 0 deletions src/v0/destinations/hs/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const {
extractIDsForSearchAPI,
validatePayloadDataTypes,
getObjectAndIdentifierType,
isIterable,
} = require('./util');
const { primaryToSecondaryFields } = require('./config');

Expand Down Expand Up @@ -239,3 +240,21 @@ describe('getRequestDataAndRequestOptions utility test cases', () => {
expect(requestData).toEqual(expectedRequestData);
});
});

describe('isIterable utility test cases', () => {
it('should return true when the input is an array', () => {
const input = [1, 2, 3];
const result = isIterable(input);
expect(result).toBe(true);
});
it('should return false when the input is null', () => {
const input = null;
const result = isIterable(input);
expect(result).toBe(false);
});
it('should return false when the input is undefined', () => {
const input = undefined;
const result = isIterable(input);
expect(result).toBe(false);
});
});
4 changes: 2 additions & 2 deletions src/v0/destinations/snapchat_conversion/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const getEventConversionType = (message) => {
// Returns the response for the track event after constructing the payload and setting necessary fields
const trackResponseBuilder = (message, { Config }, mappedEvent) => {
let payload = {};
const event = mappedEvent.trim().replace(/\s+/g, '_');
const event = mappedEvent?.toString().trim().replace(/\s+/g, '_');
const eventConversionType = getEventConversionType(message);
const { apiKey, pixelId, snapAppId, appId, deduplicationKey, enableDeduplication } = Config;
validateEventConfiguration(eventConversionType, pixelId, snapAppId, appId);
Expand Down Expand Up @@ -305,7 +305,7 @@ const eventMappingHandler = (message, destination) => {
if (!event) {
throw new InstrumentationError('Event name is required');
}
event = event.trim().replace(/\s+/g, '_');
event = event.toString().trim().replace(/\s+/g, '_');

let { rudderEventsToSnapEvents } = destination.Config;
const mappedEvents = new Set();
Expand Down
1 change: 1 addition & 0 deletions src/v1/destinations/hs/networkHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const findFeatureandVersion = (response, rudderJobMetadata, destinationConfig) =
if (
Array.isArray(results) &&
results.length !== rudderJobMetadata.length &&
Array.isArray(errors) &&
results.length + errors.length === rudderJobMetadata.length

Check warning on line 34 in src/v1/destinations/hs/networkHandler.ts

View check run for this annotation

Codecov / codecov/patch

src/v1/destinations/hs/networkHandler.ts#L32-L34

Added lines #L32 - L34 were not covered by tests
)
return 'newApiWithMultipleEventsAndErrors';

Check warning on line 36 in src/v1/destinations/hs/networkHandler.ts

View check run for this annotation

Codecov / codecov/patch

src/v1/destinations/hs/networkHandler.ts#L36

Added line #L36 was not covered by tests
Expand Down
78 changes: 78 additions & 0 deletions test/integrations/destinations/clevertap/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3354,4 +3354,82 @@ export const data = [
},
},
},
{
name: 'clevertap',
description: 'Should not throw bugsnag error if event is not of type string',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination: {
Config: {
passcode: 'sample_passcode',
accountId: '476550467',
trackAnonymous: true,
enableObjectIdMapping: false,
},
},
message: {
type: 'track',
userId: 'user123',
event: 'Product Purchased',
properties: {
name: "Rubik's Cube",
revenue: 4.99,
},
context: {
ip: '14.5.67.21',
},
timestamp: '2020-02-02T00:23:09.544Z',
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://api.clevertap.com/1/upload',
headers: {
'X-CleverTap-Account-Id': '476550467',
'X-CleverTap-Passcode': 'sample_passcode',
'Content-Type': 'application/json',
},
params: {},
body: {
JSON: {
d: [
{
evtName: 'Product Purchased',
evtData: {
name: "Rubik's Cube",
revenue: 4.99,
},
type: 'event',
identity: 'user123',
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
userId: '',
},
statusCode: 200,
},
],
},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,71 @@ export const testScenariosForV1API = [
},
},
},
{
id: 'garl_v1_scenario_4',
name: 'google_adwords_remarketing_lists',
description:
'[Proxy v1 API] :: getting concurrent_modification error code while sending request to GA audience API',
successCriteria: 'Should return 500 with destination response',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
headers: commonHeaders,
params: { ...commonParams, customerId: 'wrongCustomerId' },
JSON: validRequestPayload2,
endpoint:
'https://googleads.googleapis.com/v15/customers/wrongCustomerId/offlineUserDataJobs',
},
metadataArray,
),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
message:
'{"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure","errors":[{"errorCode":{"databaseError":"CONCURRENT_MODIFICATION"},"message":"Multiple requests were attempting to modify the same resource at once. Retry the request."}],"requestId":"08X6xmM1WJPf_lW1ppYfsA"}]}} during ga_audience response transformation',
response: [
{
error:
'{"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure","errors":[{"errorCode":{"databaseError":"CONCURRENT_MODIFICATION"},"message":"Multiple requests were attempting to modify the same resource at once. Retry the request."}],"requestId":"08X6xmM1WJPf_lW1ppYfsA"}]}} during ga_audience response transformation',
metadata: {
attemptNum: 1,
destinationId: 'default-destinationId',
dontBatch: false,
jobId: 1,
secret: {
access_token: 'default-accessToken',
},
sourceId: 'default-sourceId',
userId: 'default-userId',
workspaceId: 'default-workspaceId',
},
statusCode: 500,
},
],
statTags: {
destType: 'GOOGLE_ADWORDS_REMARKETING_LISTS',
destinationId: 'default-destinationId',
errorCategory: 'network',
errorType: 'retryable',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
workspaceId: 'default-workspaceId',
},
status: 500,
},
},
},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,52 @@ export const networkCallsData = [
},
},
},
{
httpReq: {
url: 'https://googleads.googleapis.com/v15/customers/wrongCustomerId/offlineUserDataJobs:create',
data: {
job: {
type: 'CUSTOMER_MATCH_USER_LIST',
customerMatchUserListMetadata: {
userList: 'customers/wrongCustomerId/userLists/709078448',
consent: {
adPersonalization: 'UNSPECIFIED',
adUserData: 'UNSPECIFIED',
},
},
},
},
headers: {
Authorization: 'Bearer dummy-access',
'Content-Type': 'application/json',
'developer-token': 'dummy-dev-token',
},
method: 'POST',
},
httpRes: {
status: 400,
data: {
error: {
code: 400,
message: 'Request contains an invalid argument.',
status: 'INVALID_ARGUMENT',
details: [
{
'@type': 'type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure',
errors: [
{
errorCode: {
databaseError: 'CONCURRENT_MODIFICATION',
},
message:
'Multiple requests were attempting to modify the same resource at once. Retry the request.',
},
],
requestId: '08X6xmM1WJPf_lW1ppYfsA',
},
],
},
},
},
},
];
Loading

0 comments on commit 5471119

Please sign in to comment.