Open 1tsHr0gd opened 9 months ago
Tried something different expecting the correct output but it seems there are no headers being sent in the request to Facebook. None of the other methods or classes in the library I have used so far have this problem. The catalog is being fetched properly, I have provided the required permissions when generating the access token as well so its not an Auth issue.
const FacebookAdsApi = bizSdk.FacebookAdsApi.init(accessToken);
const ProductCatalog = bizSdk.ProductCatalog;
const ProductSet = bizSdk.ProductSet;
console.log(catalogId)
console.log(pool_id)
console.log(prodIDs)
const catalog = new ProductCatalog(catalogId);
console.log("cats",catalog)
try {
const response = await catalog.createProductSet({
[ProductSet.Fields.name]: set_name,
[ProductSet.Fields.filter]: {
'product_item_id': {'eq': prodIDs}
},
});
console.log(response);
} catch (error) {
console.log("Something went wrong \n", error);
}
Here is the headers part of the error message which shows all the headers are empty and the set name and productIDs from the DB arent even being sent. I have confirmed that there is data in those variables.
message: undefined,
status: undefined,
response: undefined,
headers: undefined,
method: 'POST',
url: 'https://graph.facebook.com/v17.0/1786848041646527/product_sets?access_token=<INSERT_YOUR_TOKEN_HERE>',
data: { id: '1786848041646527' }
}
Which SDK version are you using?
^17.0.3
What's the issue?
The POST request doesnt seem to be well formed to allow for creation of a product set
Steps/Sample code to reproduce the issue
`
Observed Results:
Error at FacebookRequestError.FacebookError [as constructor] (C:\Users\Admin\Desktop\COD3\ReactJS\Sysec\node_modules\facebook-nodejs-business-sdk\dist\cjs.js:352:16) at new FacebookRequestError (C:\Users\Admin\Desktop\COD3\ReactJS\Sysec\node_modules\facebook-nodejs-business-sdk\dist\cjs.js:374:129) at C:\Users\Admin\Desktop\COD3\ReactJS\Sysec\node_modules\facebook-nodejs-business-sdk\dist\cjs.js:673:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Expected Results:
I am getting the catalogueID perfectly well. I expected the productSet to be created and I would go ahead and store the ID. Since the name is the mandatory field.