From 2db3555f41f2f4d042333a91fcf12f8ebc4a4e3f Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Thu, 26 Oct 2023 16:07:19 +0530 Subject: [PATCH 01/13] feat: error codes added in fbUtils --- .../fb_custom_audience/networkhandler.js | 6 +++ src/v0/util/facebookUtils/networkHandler.js | 43 ++++++++++++++++++- .../data/facebook_pixel_proxy_output.json | 2 +- test/__tests__/data/fb_proxy_output.json | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/v0/destinations/fb_custom_audience/networkhandler.js diff --git a/src/v0/destinations/fb_custom_audience/networkhandler.js b/src/v0/destinations/fb_custom_audience/networkhandler.js new file mode 100644 index 0000000000..0ea7aff7da --- /dev/null +++ b/src/v0/destinations/fb_custom_audience/networkhandler.js @@ -0,0 +1,6 @@ +const { networkHandler, errorResponseHandler } = require('../../util/facebookUtils/networkHandler'); + +module.exports = { + networkHandler, + errorResponseHandler, +}; diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index d53d0f76f9..d2e339f158 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -75,7 +75,7 @@ const errorDetailsMap = { 33: new ErrorDetailsExtractorBuilder() .setStatus(400) .setMessage( - "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + "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() @@ -151,6 +151,47 @@ const errorDetailsMap = { .setMessage('API User Too Many Calls') .build(), }, + // facebook custom audience related error codes + 294: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(400) + .setMessage( + 'Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist', + ) + .build(), + }, + 1487301: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(400) + .setMessage( + 'Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account', + ) + .build(), + }, + 1487366: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(400) + .setMessage('Custom Audience Has Been Deleted') + .build(), + }, + 2650: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(400) + .setMessage('Failed to update the custom audience') + .build(), + }, + 105: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(400) + .setMessage('The number of parameters exceeded the maximum for this operation') + .build(), + }, + 80003: { + default: new ErrorDetailsExtractorBuilder() + .setStatus(429) + .setMessage('There have been too many calls to this ad-account.') + .build(), + }, }; const getErrorDetailsFromErrorMap = (error) => { diff --git a/test/__tests__/data/facebook_pixel_proxy_output.json b/test/__tests__/data/facebook_pixel_proxy_output.json index 607ac7804e..e0afb028d3 100644 --- a/test/__tests__/data/facebook_pixel_proxy_output.json +++ b/test/__tests__/data/facebook_pixel_proxy_output.json @@ -91,7 +91,7 @@ { "output": { "status": 400, - "message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + "message": "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", "destinationResponse": { "error": { "message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", diff --git a/test/__tests__/data/fb_proxy_output.json b/test/__tests__/data/fb_proxy_output.json index e9dbf0d128..12e06cff2c 100644 --- a/test/__tests__/data/fb_proxy_output.json +++ b/test/__tests__/data/fb_proxy_output.json @@ -91,7 +91,7 @@ { "output": { "status": 400, - "message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + "message": "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", "destinationResponse": { "error": { "message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", From d2ca35ce36e92a18aa67ecc05960d89124e67010 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Fri, 27 Oct 2023 09:55:15 +0530 Subject: [PATCH 02/13] adding single test case --- .../fb_custom_audience/proxy_response.json | 80 +++++++++++++++++++ test/__mocks__/network.js | 3 +- .../data/fb_custom_audience_proxy_input.json | 55 +++++++++++++ .../data/fb_custom_audience_proxy_output.json | 15 ++++ test/__tests__/proxy.test.ts | 1 + 5 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 test/__mocks__/data/fb_custom_audience/proxy_response.json create mode 100644 test/__tests__/data/fb_custom_audience_proxy_input.json create mode 100644 test/__tests__/data/fb_custom_audience_proxy_output.json diff --git a/test/__mocks__/data/fb_custom_audience/proxy_response.json b/test/__mocks__/data/fb_custom_audience/proxy_response.json new file mode 100644 index 0000000000..7b5199806b --- /dev/null +++ b/test/__mocks__/data/fb_custom_audience/proxy_response.json @@ -0,0 +1,80 @@ +{ + "https://graph.facebook.com/v17.0/aud1/users": { + "successResponse": { + "data": { + "audience_id": "aud1", + "session_id": "123", + "num_received": 4, + "num_invalid_entries": 0, + "invalid_entry_samples": {} + }, + "status": 200 + }, + "permissionMissingError": { + "data": { + "error": { + "message": "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + "type": "GraphMethodException", + "code": 294, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 400 + }, + "audienceUnvailable": { + "data": { + "error": { + "message": "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", + "type": "GraphMethodException", + "code": 1487301, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 400 + }, + "deletedAudience": { + "data": { + "error": { + "message": "Custom Audience Has Been Deleted", + "type": "GraphMethodException", + "code": 1487366, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 400 + }, + "failedToUpdateAudience": { + "data": { + "error": { + "message": "Failed to update the custom audience", + "type": "GraphMethodException", + "code": 2650, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 400 + }, + "parameterExceeded": { + "data": { + "error": { + "message": "Failed to update the custom audience", + "type": "GraphMethodException", + "code": 105, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 400 + }, + "to-many-req-on-ad-account": { + "data": { + "error": { + "message": "There have been too many calls to this ad-account.", + "type": "GraphMethodException", + "code": 80003, + "fbtrace_id": "facebook_px_trace_id_5" + } + }, + "status": 429 + } + } +} \ No newline at end of file diff --git a/test/__mocks__/network.js b/test/__mocks__/network.js index 752dd48ca2..78261b9421 100644 --- a/test/__mocks__/network.js +++ b/test/__mocks__/network.js @@ -24,7 +24,8 @@ const urlDirectoryMap = { "marketo_acct_id_success.mktorest.com": "marketo_static_list", "api.criteo.com": "criteo_audience", "business-api.tiktok.com": "tiktok_ads", - "api.intercom.io": "intercom" + "api.intercom.io": "intercom", + "https://graph.facebook.com/v17.0/aud1/users": "fb_custom_audience" }; function getData(arg) { diff --git a/test/__tests__/data/fb_custom_audience_proxy_input.json b/test/__tests__/data/fb_custom_audience_proxy_input.json new file mode 100644 index 0000000000..584c286625 --- /dev/null +++ b/test/__tests__/data/fb_custom_audience_proxy_input.json @@ -0,0 +1,55 @@ +[ + { + "version": "1", + "type": "REST", + "method": "DELETE", + "endpoint": "https://graph.facebook.com/v17.0/aud1/users", + "headers": { + "test-dest-response-key": "successResponse" + }, + "params": { + "access_token": "ABC", + "payload": { + "is_raw": true, + "data_source": { + "sub_type": "ANYTHING" + }, + "schema": [ + "EMAIL", + "DOBM", + "DOBD", + "DOBY", + "PHONE", + "GEN", + "FI", + "MADID", + "ZIP", + "ST", + "COUNTRY" + ], + "data": [ + [ + "shrouti@abc.com", + "2", + "13", + "2013", + "@09432457768", + "f", + "Ms.", + "ABC", + "ZIP" , + "123abc" , + "IN" + ] + ] + } + }, + "body": { + "JSON": {}, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": {} + }, + "files": {} + } +] \ No newline at end of file diff --git a/test/__tests__/data/fb_custom_audience_proxy_output.json b/test/__tests__/data/fb_custom_audience_proxy_output.json new file mode 100644 index 0000000000..fa16860176 --- /dev/null +++ b/test/__tests__/data/fb_custom_audience_proxy_output.json @@ -0,0 +1,15 @@ +[ + { + "output": { + "status": 200, + "message": "Request Processed Successfully", + "destinationResponse": { + "audience_id": "aud1", + "invalid_entry_samples": {}, + "num_invalid_entries": 0, + "num_received": 4, + "session_id": "123" + } + } + } +] \ No newline at end of file diff --git a/test/__tests__/proxy.test.ts b/test/__tests__/proxy.test.ts index abccf8dbb4..19814cbb17 100644 --- a/test/__tests__/proxy.test.ts +++ b/test/__tests__/proxy.test.ts @@ -47,6 +47,7 @@ const destinations = [ 'criteo_audience', 'tiktok_ads', 'intercom', + 'fb_custom_audience' ]; // start of generic tests From fb33bec545cfd0a33b7733ba395c3a5d5c91357f Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Fri, 27 Oct 2023 11:59:48 +0530 Subject: [PATCH 03/13] adding test cases in new format --- .../fb_custom_audience/dataDelivery/data.ts | 168 +++++++ .../fb_custom_audience/network.ts | 444 ++++++++++++++++++ 2 files changed, 612 insertions(+) create mode 100644 test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts create mode 100644 test/integrations/destinations/fb_custom_audience/network.ts diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts new file mode 100644 index 0000000000..ae9dde7058 --- /dev/null +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -0,0 +1,168 @@ +export const data = [ + { + name: 'fb_custom_audience', + description: 'Type NA ', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "successResponse" + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: 'Request Processed Successfully', + destinationResponse: { + audience_id: 'aud1', + invalid_entry_samples: {}, + num_invalid_entries: 0, + num_received: 4, + session_id: '123' + } + } + } + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'permissionMissingError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "permissionMissingError" + }, + params: { + access_token: 'BCD', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 400, + message: 'Request failed with status: 294', + destinationResponse: { + response: { + code: 294, + message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + }, + status: 200, + }, + + }, + }, + }, + }, + } +] \ No newline at end of file diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts new file mode 100644 index 0000000000..b6a474d163 --- /dev/null +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -0,0 +1,444 @@ +export const networkCallsData = [ + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'successResponse' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "audience_id": "aud1", + "session_id": "123", + "num_received": 4, + "num_invalid_entries": 0, + "invalid_entry_samples": {} + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'BCD', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 294, + "message": "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist" + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 1487301, + "message": "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account" + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 1487366, + "message": "Custom Audience Has Been Deleted" + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 2650, + "message": "Failed to update the custom audience" + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 105, + "message": "The number of parameters exceeded the maximum for this operation" + }, + "status": 200 + } + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + 'test-dest-response-key': 'permissionMissingError' + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + "data": { + "code": 80003, + "message": "There have been too many calls to this ad-account." + }, + "status": 200 + } + } +]; \ No newline at end of file From 6baa1622ac13ebbf22663f46132c867ee2b5139c Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Fri, 27 Oct 2023 21:18:45 +0530 Subject: [PATCH 04/13] adding test cases in new format --- .../fb_custom_audience/dataDelivery/data.ts | 44 +++++++++++-------- .../fb_custom_audience/network.ts | 10 +++-- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts index ae9dde7058..72335b72cc 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -93,7 +93,7 @@ export const data = [ body: { version: '1', type: 'REST', - method: 'DELETE', + method: 'POST', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { "test-dest-response-key": "permissionMissingError" @@ -106,7 +106,6 @@ export const data = [ sub_type: 'ANYTHING', }, schema: [ - 'EMAIL', 'DOBM', 'DOBD', 'DOBY', @@ -120,7 +119,6 @@ export const data = [ ], data: [ [ - 'shrouti@abc.com', '2', '13', '2013', @@ -147,22 +145,32 @@ export const data = [ }, output: { response: { - status: 200, - body: { - output: { - status: 400, - message: 'Request failed with status: 294', - destinationResponse: { - response: { - code: 294, - message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 294, + message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + }, + status: 400, + + }, + message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "aborted", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 400, }, - status: 200, - }, - }, - }, }, - }, - } + }, + }, ] \ No newline at end of file diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index b6a474d163..60d87cc867 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -119,11 +119,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 294, - "message": "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist" + data: { + error: { + code: 294, + message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist" + } }, - "status": 200 + "status": 400 } }, { From 47c0a9ad2ee13c7d2182387838e4c79171a8b006 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:05:28 +0530 Subject: [PATCH 05/13] fix: fixing the test cases --- .../fb_custom_audience/dataDelivery/data.ts | 437 +++++++++++++++++- .../fb_custom_audience/network.ts | 66 +-- 2 files changed, 471 insertions(+), 32 deletions(-) diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts index 72335b72cc..532b81c268 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -1,7 +1,7 @@ export const data = [ { name: 'fb_custom_audience', - description: 'Type NA ', + description: 'successResponse', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -173,4 +173,439 @@ export const data = [ }, }, }, + { + name: 'fb_custom_audience', + description: 'audienceUnavailableError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "audienceUnavailableError" + }, + 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', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 1487301, + message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", + }, + status: 400, + + }, + message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "aborted", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 400, + }, + }, + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'audienceDeletedError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "audienceDeletedError" + }, + 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', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 1487366, + message: "Custom Audience Has Been Deleted", + }, + status: 400, + + }, + message: "Custom Audience Has Been Deleted", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "aborted", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 400, + }, + }, + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'failedToUpdateAudienceError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "failedToUpdateAudienceError" + }, + 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', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 2650, + message: "Failed to update the custom audience", + }, + status: 400, + + }, + message: "Failed to update the custom audience", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "aborted", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 400, + }, + }, + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'parameterExceededError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "parameterExceededError" + }, + 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', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 105, + message: "The number of parameters exceeded the maximum for this operation", + }, + status: 400, + + }, + message: "The number of parameters exceeded the maximum for this operation", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "aborted", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 400, + }, + }, + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'tooManyCallsError', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + headers: { + "test-dest-response-key": "tooManyCallsError" + }, + 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', + ], + ], + }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + } + }, + }, + output: { + response: { + status: 429, + body: { + output: { + destinationResponse: { + error: { + code: 80003, + message: "There have been too many calls to this ad-account.", + }, + status: 429, + + }, + message: "There have been too many calls to this ad-account.", + statTags: { + destType: "FB_CUSTOM_AUDIENCE", + destinationId: "Non-determininable", + errorCategory: "network", + errorType: "throttled", + feature: "dataDelivery", + implementation: "native", + module: "destination", + workspaceId: "Non-determininable", + }, + "status": 429, + }, + }, + }, + }, + } ] \ No newline at end of file diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index 60d87cc867..a74b408b2b 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -135,7 +135,7 @@ export const networkCallsData = [ method: 'DELETE', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { - 'test-dest-response-key': 'permissionMissingError' + 'test-dest-response-key': 'audienceUnavailableError' }, params: { access_token: 'ABC', @@ -145,9 +145,6 @@ export const networkCallsData = [ sub_type: 'ANYTHING', }, schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', 'DOBY', 'PHONE', 'GEN', @@ -159,9 +156,6 @@ export const networkCallsData = [ ], data: [ [ - 'shrouti@abc.com', - '2', - '13', '2013', '@09432457768', 'f', @@ -184,11 +178,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 1487301, - "message": "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account" + data: { + error: { + code: 1487301, + message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account" + } }, - "status": 200 + "status": 400 } }, { @@ -198,7 +194,7 @@ export const networkCallsData = [ method: 'DELETE', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { - 'test-dest-response-key': 'permissionMissingError' + 'test-dest-response-key': 'audienceDeletedError' }, params: { access_token: 'ABC', @@ -247,11 +243,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 1487366, - "message": "Custom Audience Has Been Deleted" + data: { + error: { + code: 1487366, + message: "Custom Audience Has Been Deleted" + } }, - "status": 200 + "status": 400 } }, { @@ -261,7 +259,7 @@ export const networkCallsData = [ method: 'DELETE', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { - 'test-dest-response-key': 'permissionMissingError' + 'test-dest-response-key': 'failedToUpdateAudienceError' }, params: { access_token: 'ABC', @@ -310,11 +308,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 2650, - "message": "Failed to update the custom audience" + data: { + error: { + code: 2650, + message: "Failed to update the custom audience" + } }, - "status": 200 + "status": 400 } }, { @@ -324,7 +324,7 @@ export const networkCallsData = [ method: 'DELETE', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { - 'test-dest-response-key': 'permissionMissingError' + 'test-dest-response-key': 'parameterExceededError' }, params: { access_token: 'ABC', @@ -373,11 +373,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 105, - "message": "The number of parameters exceeded the maximum for this operation" + data: { + error: { + code: 105, + message: "The number of parameters exceeded the maximum for this operation" + } }, - "status": 200 + "status": 400 } }, { @@ -387,7 +389,7 @@ export const networkCallsData = [ method: 'DELETE', endpoint: 'https://graph.facebook.com/v17.0/aud1/users', headers: { - 'test-dest-response-key': 'permissionMissingError' + 'test-dest-response-key': 'tooManyCallsError' }, params: { access_token: 'ABC', @@ -436,11 +438,13 @@ export const networkCallsData = [ files: {}, }, httpRes: { - "data": { - "code": 80003, - "message": "There have been too many calls to this ad-account." + data: { + error: { + code: 80003, + message: "There have been too many calls to this ad-account." + } }, - "status": 200 + "status": 429 } } ]; \ No newline at end of file From 213a2dcb605a7a087789345ee26bca4e23fa67ed Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:13:24 +0530 Subject: [PATCH 06/13] fix: cleaning up files --- .../fb_custom_audience/proxy_response.json | 80 ------------------- .../data/fb_custom_audience_proxy_input.json | 55 ------------- .../data/fb_custom_audience_proxy_output.json | 15 ---- test/__tests__/proxy.test.ts | 1 - .../fb_custom_audience/dataDelivery/data.ts | 6 ++ .../fb_custom_audience/network.ts | 18 +++-- 6 files changed, 18 insertions(+), 157 deletions(-) delete mode 100644 test/__mocks__/data/fb_custom_audience/proxy_response.json delete mode 100644 test/__tests__/data/fb_custom_audience_proxy_input.json delete mode 100644 test/__tests__/data/fb_custom_audience_proxy_output.json diff --git a/test/__mocks__/data/fb_custom_audience/proxy_response.json b/test/__mocks__/data/fb_custom_audience/proxy_response.json deleted file mode 100644 index 7b5199806b..0000000000 --- a/test/__mocks__/data/fb_custom_audience/proxy_response.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "https://graph.facebook.com/v17.0/aud1/users": { - "successResponse": { - "data": { - "audience_id": "aud1", - "session_id": "123", - "num_received": 4, - "num_invalid_entries": 0, - "invalid_entry_samples": {} - }, - "status": 200 - }, - "permissionMissingError": { - "data": { - "error": { - "message": "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", - "type": "GraphMethodException", - "code": 294, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 400 - }, - "audienceUnvailable": { - "data": { - "error": { - "message": "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", - "type": "GraphMethodException", - "code": 1487301, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 400 - }, - "deletedAudience": { - "data": { - "error": { - "message": "Custom Audience Has Been Deleted", - "type": "GraphMethodException", - "code": 1487366, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 400 - }, - "failedToUpdateAudience": { - "data": { - "error": { - "message": "Failed to update the custom audience", - "type": "GraphMethodException", - "code": 2650, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 400 - }, - "parameterExceeded": { - "data": { - "error": { - "message": "Failed to update the custom audience", - "type": "GraphMethodException", - "code": 105, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 400 - }, - "to-many-req-on-ad-account": { - "data": { - "error": { - "message": "There have been too many calls to this ad-account.", - "type": "GraphMethodException", - "code": 80003, - "fbtrace_id": "facebook_px_trace_id_5" - } - }, - "status": 429 - } - } -} \ No newline at end of file diff --git a/test/__tests__/data/fb_custom_audience_proxy_input.json b/test/__tests__/data/fb_custom_audience_proxy_input.json deleted file mode 100644 index 584c286625..0000000000 --- a/test/__tests__/data/fb_custom_audience_proxy_input.json +++ /dev/null @@ -1,55 +0,0 @@ -[ - { - "version": "1", - "type": "REST", - "method": "DELETE", - "endpoint": "https://graph.facebook.com/v17.0/aud1/users", - "headers": { - "test-dest-response-key": "successResponse" - }, - "params": { - "access_token": "ABC", - "payload": { - "is_raw": true, - "data_source": { - "sub_type": "ANYTHING" - }, - "schema": [ - "EMAIL", - "DOBM", - "DOBD", - "DOBY", - "PHONE", - "GEN", - "FI", - "MADID", - "ZIP", - "ST", - "COUNTRY" - ], - "data": [ - [ - "shrouti@abc.com", - "2", - "13", - "2013", - "@09432457768", - "f", - "Ms.", - "ABC", - "ZIP" , - "123abc" , - "IN" - ] - ] - } - }, - "body": { - "JSON": {}, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - } -] \ No newline at end of file diff --git a/test/__tests__/data/fb_custom_audience_proxy_output.json b/test/__tests__/data/fb_custom_audience_proxy_output.json deleted file mode 100644 index fa16860176..0000000000 --- a/test/__tests__/data/fb_custom_audience_proxy_output.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "output": { - "status": 200, - "message": "Request Processed Successfully", - "destinationResponse": { - "audience_id": "aud1", - "invalid_entry_samples": {}, - "num_invalid_entries": 0, - "num_received": 4, - "session_id": "123" - } - } - } -] \ No newline at end of file diff --git a/test/__tests__/proxy.test.ts b/test/__tests__/proxy.test.ts index 19814cbb17..abccf8dbb4 100644 --- a/test/__tests__/proxy.test.ts +++ b/test/__tests__/proxy.test.ts @@ -47,7 +47,6 @@ const destinations = [ 'criteo_audience', 'tiktok_ads', 'intercom', - 'fb_custom_audience' ]; // start of generic tests diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts index 532b81c268..e204fca98d 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -152,6 +152,7 @@ export const data = [ error: { code: 294, message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + type: "GraphMethodException", }, status: 400, @@ -239,6 +240,7 @@ export const data = [ error: { code: 1487301, message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", + type: "GraphMethodException", }, status: 400, @@ -326,6 +328,7 @@ export const data = [ error: { code: 1487366, message: "Custom Audience Has Been Deleted", + type: "GraphMethodException", }, status: 400, @@ -413,6 +416,7 @@ export const data = [ error: { code: 2650, message: "Failed to update the custom audience", + type: "GraphMethodException", }, status: 400, @@ -500,6 +504,7 @@ export const data = [ error: { code: 105, message: "The number of parameters exceeded the maximum for this operation", + type: "GraphMethodException", }, status: 400, @@ -587,6 +592,7 @@ export const data = [ error: { code: 80003, message: "There have been too many calls to this ad-account.", + type: "GraphMethodException", }, status: 429, diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index a74b408b2b..2c19a6fe0d 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -122,7 +122,8 @@ export const networkCallsData = [ data: { error: { code: 294, - message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist" + message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", + type: "GraphMethodException", } }, "status": 400 @@ -181,7 +182,8 @@ export const networkCallsData = [ data: { error: { code: 1487301, - message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account" + message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", + type: "GraphMethodException", } }, "status": 400 @@ -246,7 +248,8 @@ export const networkCallsData = [ data: { error: { code: 1487366, - message: "Custom Audience Has Been Deleted" + message: "Custom Audience Has Been Deleted", + type: "GraphMethodException", } }, "status": 400 @@ -311,7 +314,8 @@ export const networkCallsData = [ data: { error: { code: 2650, - message: "Failed to update the custom audience" + message: "Failed to update the custom audience", + type: "GraphMethodException", } }, "status": 400 @@ -376,7 +380,8 @@ export const networkCallsData = [ data: { error: { code: 105, - message: "The number of parameters exceeded the maximum for this operation" + message: "The number of parameters exceeded the maximum for this operation", + type: "GraphMethodException", } }, "status": 400 @@ -441,7 +446,8 @@ export const networkCallsData = [ data: { error: { code: 80003, - message: "There have been too many calls to this ad-account." + message: "There have been too many calls to this ad-account.", + type: "GraphMethodException", } }, "status": 429 From 260c8b4c159e6c159f06a79248702b122b62d0bb Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:14:58 +0530 Subject: [PATCH 07/13] fix: cleaning up files --- test/__mocks__/network.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/__mocks__/network.js b/test/__mocks__/network.js index 78261b9421..a55814c028 100644 --- a/test/__mocks__/network.js +++ b/test/__mocks__/network.js @@ -25,7 +25,6 @@ const urlDirectoryMap = { "api.criteo.com": "criteo_audience", "business-api.tiktok.com": "tiktok_ads", "api.intercom.io": "intercom", - "https://graph.facebook.com/v17.0/aud1/users": "fb_custom_audience" }; function getData(arg) { From d01a99c6ad700c91a69139bf490c41de46d34a78 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:15:30 +0530 Subject: [PATCH 08/13] fix: cleaning up files --- test/__mocks__/network.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/__mocks__/network.js b/test/__mocks__/network.js index a55814c028..752dd48ca2 100644 --- a/test/__mocks__/network.js +++ b/test/__mocks__/network.js @@ -24,7 +24,7 @@ const urlDirectoryMap = { "marketo_acct_id_success.mktorest.com": "marketo_static_list", "api.criteo.com": "criteo_audience", "business-api.tiktok.com": "tiktok_ads", - "api.intercom.io": "intercom", + "api.intercom.io": "intercom" }; function getData(arg) { From e8a7373fbac42e3a613fccefc50c60d3eedcbacc Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:26:07 +0530 Subject: [PATCH 09/13] fix: review comments addressed --- src/v0/util/facebookUtils/networkHandler.js | 3 +++ .../destinations/facebook_pixel/dataDelivery/data.ts | 2 +- test/integrations/destinations/fb/dataDelivery/data.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index d2e339f158..87c2ced2b4 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -152,6 +152,9 @@ const errorDetailsMap = { .build(), }, // facebook custom audience related error codes + // ref: + // https://developers.facebook.com/docs/marketing-api/reference/custom-audience/#error-codes-4 + // https://developers.facebook.com/docs/marketing-api/error-reference/ 294: { default: new ErrorDetailsExtractorBuilder() .setStatus(400) diff --git a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts index e4e4a7d4c8..d560658341 100644 --- a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts +++ b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts @@ -290,7 +290,7 @@ export const data = [ output: { status: 400, message: - "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + "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", destinationResponse: { error: { message: diff --git a/test/integrations/destinations/fb/dataDelivery/data.ts b/test/integrations/destinations/fb/dataDelivery/data.ts index 70538a6ea0..c50cffee80 100644 --- a/test/integrations/destinations/fb/dataDelivery/data.ts +++ b/test/integrations/destinations/fb/dataDelivery/data.ts @@ -328,7 +328,7 @@ export const data = [ "body": { "output": { "status": 400, - "message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + "message": "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", "destinationResponse": { "error": { "message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", From 684a6303709421f02f28774b7d5c967a72c2aab5 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 10:39:00 +0530 Subject: [PATCH 10/13] fix: review comments addressed --- .../fb_custom_audience/dataDelivery/data.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts index e204fca98d..ddb081ba87 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -1,7 +1,7 @@ export const data = [ { name: 'fb_custom_audience', - description: 'successResponse', + description: 'successfully adding users to audience', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -84,7 +84,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'permissionMissingError', + description: 'user addition failed due to missing permission', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -176,7 +176,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'audienceUnavailableError', + description: 'user addition failed due to unavailable audience error', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -264,7 +264,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'audienceDeletedError', + description: 'user addition failed because the custom audience has been deleted', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -352,7 +352,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'failedToUpdateAudienceError', + description: 'Failed to update the custom audience for unknown reason', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -440,7 +440,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'parameterExceededError', + description: 'Failed to update the custom audience as excessive number of parameters were passed in the request', feature: 'dataDelivery', module: 'destination', version: 'v0', @@ -528,7 +528,7 @@ export const data = [ }, { name: 'fb_custom_audience', - description: 'tooManyCallsError', + description: 'user update request is throttled due to too many calls to the ad account', feature: 'dataDelivery', module: 'destination', version: 'v0', From b345c8beaa313806fb5a0e98818e198c5dae6c39 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Mon, 30 Oct 2023 11:25:41 +0530 Subject: [PATCH 11/13] Empty commit From b2890b82d1dc50c7b042a4e7d9fbed52c8ca957b Mon Sep 17 00:00:00 2001 From: Sai Sankeerth Date: Mon, 30 Oct 2023 12:31:59 +0530 Subject: [PATCH 12/13] fix: deleting wrongly spelled file --- src/v0/destinations/fb_custom_audience/networkhandler.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/v0/destinations/fb_custom_audience/networkhandler.js diff --git a/src/v0/destinations/fb_custom_audience/networkhandler.js b/src/v0/destinations/fb_custom_audience/networkhandler.js deleted file mode 100644 index 0ea7aff7da..0000000000 --- a/src/v0/destinations/fb_custom_audience/networkhandler.js +++ /dev/null @@ -1,6 +0,0 @@ -const { networkHandler, errorResponseHandler } = require('../../util/facebookUtils/networkHandler'); - -module.exports = { - networkHandler, - errorResponseHandler, -}; From 989a3f7066d46f785d365f57d57d31b0c1a4f51a Mon Sep 17 00:00:00 2001 From: Sai Sankeerth Date: Mon, 30 Oct 2023 12:32:49 +0530 Subject: [PATCH 13/13] fix: add network handler for fb_custom_audience with correct spelling --- src/v0/destinations/fb_custom_audience/networkHandler.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/v0/destinations/fb_custom_audience/networkHandler.js diff --git a/src/v0/destinations/fb_custom_audience/networkHandler.js b/src/v0/destinations/fb_custom_audience/networkHandler.js new file mode 100644 index 0000000000..0ea7aff7da --- /dev/null +++ b/src/v0/destinations/fb_custom_audience/networkHandler.js @@ -0,0 +1,6 @@ +const { networkHandler, errorResponseHandler } = require('../../util/facebookUtils/networkHandler'); + +module.exports = { + networkHandler, + errorResponseHandler, +};