Skip to content

Commit

Permalink
fix: send proper status to server in cm360 (#3127)
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishmalik committed Mar 12, 2024
1 parent e43b83d commit 229ce47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/v1/destinations/campaign_manager/networkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ const responseHandler = (responseParams) => {
const errorMessage = response.error?.message || 'unknown error format';
for (const metadata of rudderJobMetadata) {
responseWithIndividualEvents.push({
statusCode: 500,
statusCode: status,
metadata,
error: errorMessage,
});
}

throw new TransformerProxyError(
`Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation`,
500,
status,
{
[tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,14 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
},
output: {
response: {
status: 500,
status: 401,
body: {
output: {
response: [
{
error:
'{"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","errors":[{"message":"Login Required.","domain":"global","reason":"required","location":"Authorization","locationType":"header"}],"status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CREDENTIALS_MISSING","domain":"googleapis.com","metadata":{"method":"google.ads.xfa.op.v4.DfareportingConversions.Batchinsert","service":"googleapis.com"}}]}}',
statusCode: 500,
statusCode: 401,
metadata: {
jobId: 1,
attemptNum: 1,
Expand Down Expand Up @@ -361,7 +361,7 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
authErrorCategory: 'REFRESH_TOKEN',
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 401,
},
},
},
Expand Down Expand Up @@ -389,14 +389,14 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
},
output: {
response: {
status: 500,
status: 403,
body: {
output: {
response: [
{
error:
'{"error":{"code":403,"message":"Request had insufficient authentication scopes.","errors":[{"message":"Insufficient Permission","domain":"global","reason":"insufficientPermissions"}],"status":"PERMISSION_DENIED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"ACCESS_TOKEN_SCOPE_INSUFFICIENT","domain":"googleapis.com","metadata":{"service":"gmail.googleapis.com","method":"caribou.api.proto.MailboxService.GetProfile"}}]}}',
statusCode: 500,
statusCode: 403,
metadata: {
jobId: 1,
attemptNum: 1,
Expand Down Expand Up @@ -424,7 +424,7 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
authErrorCategory: 'AUTH_STATUS_INACTIVE',
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 403,
},
},
},
Expand Down Expand Up @@ -452,14 +452,14 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
},
output: {
response: {
status: 500,
status: 403,
body: {
output: {
response: [
{
error:
'{"error":{"code":403,"message":"invalid_grant","error_description":"Bad accesss"}}',
statusCode: 500,
statusCode: 403,
metadata: {
jobId: 1,
attemptNum: 1,
Expand Down Expand Up @@ -487,7 +487,7 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
authErrorCategory: 'AUTH_STATUS_INACTIVE',
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 403,
},
},
},
Expand All @@ -514,14 +514,14 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
},
output: {
response: {
status: 500,
status: 401,
body: {
output: {
response: [
{
error:
'{"error":"unauthorized","error_description":"Access token expired: 2020-10-20T12:00:00.000Z"}',
statusCode: 500,
statusCode: 401,
metadata: {
jobId: 1,
attemptNum: 1,
Expand Down Expand Up @@ -549,7 +549,7 @@ export const v1oauthScenarios: ProxyV1TestData[] = [
authErrorCategory: 'REFRESH_TOKEN',
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 401,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const otherScenariosV1: ProxyV1TestData[] = [
{
error:
'{"error":{"message":"Service Unavailable","description":"The server is currently unable to handle the request due to temporary overloading or maintenance of the server. Please try again later."}}',
statusCode: 500,
statusCode: 503,
metadata: {
jobId: 1,
attemptNum: 1,
Expand All @@ -287,7 +287,7 @@ export const otherScenariosV1: ProxyV1TestData[] = [
},
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 503,
},
},
},
Expand Down Expand Up @@ -376,7 +376,7 @@ export const otherScenariosV1: ProxyV1TestData[] = [
response: [
{
error: '"Gateway Timeout"',
statusCode: 500,
statusCode: 504,
metadata: {
jobId: 1,
attemptNum: 1,
Expand All @@ -403,7 +403,7 @@ export const otherScenariosV1: ProxyV1TestData[] = [
},
message:
'Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation',
status: 500,
status: 504,
},
},
},
Expand Down

0 comments on commit 229ce47

Please sign in to comment.