Skip to content

Commit

Permalink
chore(release): pull hotfix-release/v1.50.1 into main (#2874)
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc authored Dec 5, 2023
2 parents 4bde435 + a97f6db commit e04cedd
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.50.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.50.0...v1.50.1) (2023-12-05)


### Bug Fixes

* salesforce transformer proxy response handling issue for authorization flow ([#2873](https://github.com/rudderlabs/rudder-transformer/issues/2873)) ([4cec65e](https://github.com/rudderlabs/rudder-transformer/commit/4cec65e4103e99021f5108fcc7c557b952f1c5eb))

## [1.50.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.49.1...v1.50.0) (2023-11-13)


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.50.0",
"version": "1.50.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
2 changes: 2 additions & 0 deletions src/v0/destinations/salesforce/networkHandler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network');
const { processAxiosResponse } = require('../../../adapters/utils/networkUtils');
const { LEGACY } = require('./config');
const { salesforceResponseHandler } = require('./utils');

const responseHandler = (destinationResponse, destType) => {
Expand All @@ -9,6 +10,7 @@ const responseHandler = (destinationResponse, destType) => {
destinationResponse,
'during Salesforce Response Handling',
destinationResponse?.rudderJobMetadata?.destInfo?.authKey,
LEGACY
);

// else successfully return status as 200, message and original destination response
Expand Down
15 changes: 10 additions & 5 deletions src/v0/destinations/salesforce/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,21 @@ const salesforceResponseHandler = (destResponse, sourceMessage, authKey, authori
const matchErrorCode = (errorCode) =>
response && Array.isArray(response) && response.some((resp) => resp?.errorCode === errorCode);
if (status === 401 && authKey && matchErrorCode('INVALID_SESSION_ID')) {
if (authorizationFlow === LEGACY) {
// checking for invalid/expired token errors and evicting cache in that case
// rudderJobMetadata contains some destination info which is being used to evict the cache
ACCESS_TOKEN_CACHE.del(authKey);
if (authorizationFlow === OAUTH) {
throw new RetryableError(

Check warning on line 37 in src/v0/destinations/salesforce/utils.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/salesforce/utils.js#L37

Added line #L37 was not covered by tests
`${DESTINATION} Request Failed - due to "INVALID_SESSION_ID", (Retryable) ${sourceMessage}`,
500,
destResponse,
getAuthErrCategoryFromStCode(status),
);
}
// checking for invalid/expired token errors and evicting cache in that case
// rudderJobMetadata contains some destination info which is being used to evict the cache
ACCESS_TOKEN_CACHE.del(authKey);
throw new RetryableError(
`${DESTINATION} Request Failed - due to "INVALID_SESSION_ID", (Retryable) ${sourceMessage}`,
500,
destResponse,
authorizationFlow === LEGACY ? '' : getAuthErrCategoryFromStCode(status),
);
} else if (status === 403 && matchErrorCode('REQUEST_LIMIT_EXCEEDED')) {
// If the error code is REQUEST_LIMIT_EXCEEDED, you’ve exceeded API request limits in your org.
Expand Down
33 changes: 33 additions & 0 deletions src/v0/destinations/salesforce_oauth/networkHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network');
const { processAxiosResponse } = require('../../../adapters/utils/networkUtils');
const { OAUTH } = require('../salesforce/config');
const { salesforceResponseHandler } = require('../salesforce/utils');

const responseHandler = (destinationResponse, destType) => {
const message = `Request for destination: ${destType} Processed Successfully`;

Check warning on line 7 in src/v0/destinations/salesforce_oauth/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/salesforce_oauth/networkHandler.js#L7

Added line #L7 was not covered by tests

salesforceResponseHandler(

Check warning on line 9 in src/v0/destinations/salesforce_oauth/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/salesforce_oauth/networkHandler.js#L9

Added line #L9 was not covered by tests
destinationResponse,
'during Salesforce Response Handling',
destinationResponse?.rudderJobMetadata?.destInfo?.authKey,
OAUTH
);

// else successfully return status as 200, message and original destination response
return {

Check warning on line 17 in src/v0/destinations/salesforce_oauth/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/salesforce_oauth/networkHandler.js#L17

Added line #L17 was not covered by tests
status: 200,
message,
destinationResponse,
};
};

function networkHandler() {
this.responseHandler = responseHandler;
this.proxy = proxyRequest;
this.prepareProxy = prepareProxyRequest;
this.processAxiosResponse = processAxiosResponse;

Check warning on line 28 in src/v0/destinations/salesforce_oauth/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/salesforce_oauth/networkHandler.js#L24-L28

Added lines #L24 - L28 were not covered by tests
}

module.exports = {
networkHandler,
};
2 changes: 2 additions & 0 deletions test/__tests__/facebook_conversions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const outputRouterDataFile = fs.readFileSync(
const inputRouterData = JSON.parse(inputRouterDataFile);
const expectedRouterData = JSON.parse(outputRouterDataFile);

Date.now = jest.fn(() => new Date("2023-11-12T15:46:51.000Z")); // 2023-11-12T15:46:51.693229+05:30

describe(`${name} Tests`, () => {
describe("Processor", () => {
testData.forEach((dataPoint, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export const data = [
body: {
output: {
status: 500,
authErrorCategory: 'REFRESH_TOKEN',
message:
'Salesforce Request Failed - due to "INVALID_SESSION_ID", (Retryable) during Salesforce Response Handling',
destinationResponse: {
Expand Down

0 comments on commit e04cedd

Please sign in to comment.