Skip to content

Commit

Permalink
feat: reviw comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Jan 30, 2024
1 parent 62dfa32 commit 300e50c
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 117 deletions.
110 changes: 38 additions & 72 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
Expand Up @@ -64,7 +64,7 @@
"@koa/router": "^12.0.0",
"@ndhoule/extend": "^2.0.0",
"@pyroscope/nodejs": "^0.2.6",
"@rudderstack/integrations-lib": "^0.1.8",
"@rudderstack/integrations-lib": "file:../rudder-integrations-lib",
"@rudderstack/workflow-engine": "^0.6.9",
"ajv": "^8.12.0",
"ajv-draft-04": "^1.0.0",
Expand Down
7 changes: 2 additions & 5 deletions src/v0/util/facebookUtils/networkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { isEmpty } = require('lodash');
const get = require('get-value');
const {
NetworkError,
UnauthorizedError,
ConfigurationAuthError,
isDefinedAndNotNull,
} = require('@rudderstack/integrations-lib');
const {
Expand Down Expand Up @@ -252,10 +252,7 @@ const errorResponseHandler = (destResponse) => {
const { error } = response;
const { status, errorMessage, stats: errorStatTags } = getStatus(error);
if (isDefinedAndNotNull(errorStatTags) && errorStatTags?.errorType === 'accessTokenExpired') {
throw new UnauthorizedError(`${errorMessage}`, status, {
...response,
status: destResponse.status,
});
throw new ConfigurationAuthError(`${errorMessage}`);
}
throw new NetworkError(
`${errorMessage || error.message || 'Unknown failure during response transformation'}`,
Expand Down
16 changes: 4 additions & 12 deletions test/integrations/destinations/facebook_pixel/dataDelivery/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,14 @@ export const data = [
output: {
status: 400,
message: 'Invalid OAuth 2.0 access token',
destinationResponse: {
error: {
message: 'The access token could not be decrypted',
type: 'OAuthException',
code: 190,
fbtrace_id: 'fbpixel_trace_id',
},
status: 500,
},
destinationResponse: '',
statTags: {
destType: 'FACEBOOK_PIXEL',
errorCategory: 'network',
errorCategory: 'dataValidation',
destinationId: 'Non-determininable',
workspaceId: 'Non-determininable',
errorType: 'aborted',
meta: 'unauthorized',
errorType: 'configuration',
meta: 'accessTokenExpired',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
Expand Down
16 changes: 4 additions & 12 deletions test/integrations/destinations/fb/dataDelivery/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,14 @@ export const data = [
output: {
status: 400,
message: 'Invalid OAuth 2.0 access token',
destinationResponse: {
error: {
message: 'The access token could not be decrypted',
type: 'OAuthException',
code: 190,
fbtrace_id: 'fbpixel_trace_id',
},
status: 500,
},
destinationResponse: '',
statTags: {
destType: 'FB',
errorCategory: 'network',
errorCategory: 'dataValidation',
destinationId: 'Non-determininable',
workspaceId: 'Non-determininable',
errorType: 'aborted',
meta: 'unauthorized',
errorType: 'configuration',
meta: 'accessTokenExpired',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export const data = [
},
{
name: 'fb_custom_audience',
description: 'user addition failed due to unavailable audience error',
description: 'user addition failed due expired access token error',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
Expand Down Expand Up @@ -614,24 +614,14 @@ export const data = [
status: 400,
body: {
output: {
destinationResponse: {
error: {
message:
'Error validating access token: Session has expired on Tuesday, 01-Aug-23 10:12:14 PDT. The current time is Sunday, 28-Jan-24 16:01:17 PST.',
type: 'OAuthException',
code: 190,
error_subcode: 463,
fbtrace_id: 'A3b8C6PpI-kdIOwPwV4PANi',
},
status: 400,
},
destinationResponse: '',
message: 'Invalid OAuth 2.0 access token',
statTags: {
destType: 'FB_CUSTOM_AUDIENCE',
destinationId: 'Non-determininable',
errorCategory: 'network',
errorType: 'aborted',
meta: 'unauthorized',
errorCategory: 'dataValidation',
errorType: 'configuration',
meta: 'accessTokenExpired',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
Expand Down

0 comments on commit 300e50c

Please sign in to comment.