Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Product Sets and adding items #266

Open
1tsHr0gd opened this issue Nov 24, 2023 · 1 comment
Open

Creating Product Sets and adding items #266

1tsHr0gd opened this issue Nov 24, 2023 · 1 comment

Comments

@1tsHr0gd
Copy link

1tsHr0gd commented Nov 24, 2023

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

`
const api = bizSdk.FacebookAdsApi.init(accessToken);
const catalogs = await new Business(businessId).getOwnedProductCatalogs();
const catalogId = catalogs[0].id;
console.log("CatalogueID",catalogId)
const productSet = await new ProductCatalog(catalogId).createProductSet({},{"name": "TestSetPersonal","filter":""});

`

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)

  • What happened? This could be a description, log output, etc.

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.

  • What did you expect to happen?
@1tsHr0gd
Copy link
Author

1tsHr0gd commented Nov 27, 2023

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' }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant