facebook-nodejs-business-sdk icon indicating copy to clipboard operation
facebook-nodejs-business-sdk copied to clipboard

Undefined headers in successful responses

Open Sirach99 opened this issue 1 year ago • 4 comments

Which SDK version are you using?

19.0.2

What's the issue? / Observed Results

Headers are undefined in successful responses. Like

{
  headers: undefined, 
  ...
}

However, headers are set correctly in errored responses. Like

{
  headers: Object [AxiosHeaders] {'x-app-usage': ...}, 
  ...
}

This has been a frequently requested fix, see: https://github.com/facebook/facebook-nodejs-business-sdk/issues/87#issuecomment-1967385327 https://github.com/facebook/facebook-nodejs-business-sdk/pull/219 https://github.com/facebook/facebook-nodejs-business-sdk/pull/220

Steps/Sample code to reproduce the issue

  1. Make a request. (I called user.getAdAccounts)
  2. Log headers
  3. Confirm they are undefined in successful responses.

Expected Results:

Headers to contain values such as x-app-usage and x-fb-ads-insights-throttle. This is very important for throttling API calls.

cc: @stcheng

Sirach99 avatar Mar 24 '24 08:03 Sirach99

Any updates here, @stcheng?

Sirach99 avatar Apr 02 '24 20:04 Sirach99

@Sirach99 it seems that multiple fixes have been merged. Were you able to determine if the past fixes addressed the issue and debug it to figure out the problem?

stcheng avatar Apr 02 '24 22:04 stcheng

Hi @stcheng, sorry for the delay. The PR I just added results in displaying the headers as expected.

However, the x-fb-ads-insights-throttle header is still missing for Marketing API calls. Could you please investigate that when you get the chance?

Sirach99 avatar Apr 15 '24 15:04 Sirach99

Accidentally was not making call to Insights API. Now that I am, I see the x-fb-ads-insights-throttle header.

PR solves header issue I was having 👍

Sirach99 avatar Apr 16 '24 15:04 Sirach99