facebook/facebook-nodejs-business-sdk

Not receiving specific errors when calling

Closed this issue ยท 12 comments

dtsehl commented

Which SDK version are you using?

17.0.3

What's the issue?

We are not receiving any error codes, specific errors or anything similar when calling various endpoints, so we cannot debug what an error might be when we send a call. We are only receiving a generic FacebookRequestError.

Steps/Sample code to reproduce the issue

try {
                await this.init(access_token);
                const savedAudience = new bizSdk.SavedAudience(audienceId);
                const result = await savedAudience.read(
                    fields,
                );
                return result;
} catch (error) {
  console.error(error);
}

Observed Results:

We are receiving this error response back when making the call:

  "name": "FacebookRequestError",
  "stack": "Error\n    at FacebookRequestError.FacebookError ... at new FacebookRequestError ...
  "method": "GET",
  "url": "https://graph.facebook.com/v17.0/act_correctAccountNumber/saved_audiences?fields=id%2Cname&access_token=correct_token",
  "data": {}
}

Expected Results:

We expect a more verbose error back other than a generic FacebookRequestError, so that we can debug what the issue is.

For example:

{
    "message": "Application does not have permission for this action",
    "type": "OAuthException",
    "code": 10,
    "error_subcode": 2446325,
    "is_transient": false,
    "error_user_title": "Business Account Not Allowed to Advertise",
    "error_user_msg": "This business account didn't comply with our Advertising Policies or other standards.",
  }

+1

Same issue, fixed by downgrading to v17.0.2 so most probably introduced by this commit.

@stcheng Would you be able to have a look at it?

will take a look. if no short term feasible solutions, i would probably do a git revert on this specific commit. thanks for reporting this.

You should debug "constructErrorResponse" method and see what fields axios response returns. You return undefined because you do not construct from the correct fields on version 18.0.1.

@stcheng have you had a chance to debug this one yet?

working on a fix; will update soon.

Thanks!

anyone please help verify if this issue has been properly addressed and if that is the case i'll tag a new version thank you all

closing this as addressed in v18.0.2.

Sorry for the late reply. I am able to confirm that the fix worked on v18.0.2. Thank you :)

@krishna-koushik no worries. thanks for confirming this.

Hey @stcheng thanks for the fix, but why wasn't this backported to v17 given it's still in the support period?