From dfa0cbd3608d22340c9acb5769af4173be4d4bfc Mon Sep 17 00:00:00 2001 From: shrouti1507 <60211312+shrouti1507@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:48:10 +0530 Subject: [PATCH] fix: adding actual error messgae for default code in facebook destinations (#3490) * fix: adding actual error messgae for default code in facebook destinations * fix: edit of test case description --- src/v0/util/facebookUtils/networkHandler.js | 5 +- .../facebook_pixel/dataDelivery/business.ts | 4 +- .../facebook_pixel/dataDelivery/data.ts | 2 +- .../dataDelivery/business.ts | 46 +++++++++++++++++++ .../fb_custom_audience/network.ts | 41 +++++++++++++++++ 5 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index a84128e140..5338364fe2 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -85,10 +85,7 @@ const errorDetailsMap = { "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", ) .build(), - default: new ErrorDetailsExtractorBuilder() - .setStatus(400) - .setMessage('Invalid Parameter') - .build(), + default: new ErrorDetailsExtractorBuilder().setStatus(400).setMessageField('message').build(), }, 1: { // An unknown error occurred. diff --git a/test/integrations/destinations/facebook_pixel/dataDelivery/business.ts b/test/integrations/destinations/facebook_pixel/dataDelivery/business.ts index 9ac709978d..1b425ac5fa 100644 --- a/test/integrations/destinations/facebook_pixel/dataDelivery/business.ts +++ b/test/integrations/destinations/facebook_pixel/dataDelivery/business.ts @@ -241,11 +241,11 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ body: { output: { status: 400, - message: 'Invalid Parameter', + message: 'Unsupported post request. some problem with sent parameters', statTags, response: [ { - error: 'Invalid Parameter', + error: 'Unsupported post request. some problem with sent parameters', statusCode: 400, metadata: generateMetadata(1), }, diff --git a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts index dcc633e1a8..e66e98bbe3 100644 --- a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts +++ b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts @@ -362,7 +362,7 @@ export const v0TestData = [ body: { output: { status: 400, - message: 'Invalid Parameter', + message: 'Unsupported post request. some problem with sent parameters', destinationResponse: { error: { message: 'Unsupported post request. some problem with sent parameters', diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/business.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/business.ts index c48ad227ab..6334094b3a 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/business.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/business.ts @@ -424,4 +424,50 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ }, }, }, + { + id: 'fbca_v1_scenario_9', + name: 'fb_custom_audience', + description: 'user deletion failed differently created custom audience', + successCriteria: 'Fail with status code 400 and sending the actual error message.', + scenario: 'Business', + feature: 'dataDelivery', + module: 'destination', + version: 'v1', + input: { + request: { + body: generateProxyV1Payload({ + method: 'DELETE', + endpoint: getEndPoint('aud-value-based'), + headers: { + 'test-dest-response-key': 'validAccessToken', + }, + params: testParams2, + }), + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 400, + message: '(#100) Value-Based Custom Audience requires LOOKALIKE_VALUE attribute.', + statTags: { + ...statTags, + errorCategory: 'network', + errorType: 'aborted', + }, + response: [ + { + error: '(#100) Value-Based Custom Audience requires LOOKALIKE_VALUE attribute.', + statusCode: 400, + metadata: generateMetadata(1), + }, + ], + }, + }, + }, + }, + }, ]; diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index 3331f874a3..369c27afa9 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -583,4 +583,45 @@ export const networkCallsData = [ status: 400, }, }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud-value-based'), + headers: { + 'test-dest-response-key': 'validAccessToken', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: { + error: { + message: '(#100) Value-Based Custom Audience requires LOOKALIKE_VALUE attribute.', + type: 'OAuthException', + code: 100, + fbtrace_id: 'ADB2jAGDMC_CbfM9430kDdQ', + }, + }, + status: 400, + }, + }, ];