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

Cannot access request error details from FacebookRequestError #234

Open
GHSVerde opened this issue Oct 5, 2022 · 5 comments
Open

Cannot access request error details from FacebookRequestError #234

GHSVerde opened this issue Oct 5, 2022 · 5 comments

Comments

@GHSVerde
Copy link

GHSVerde commented Oct 5, 2022

Which SDK version are you using?

14.0.0

What's the issue?

Can't access the message or code response from the FacebookRequestError object. I use the SDK for creating ads through a platform and every time something goes wrong with the request, the SDK returns an instance of FacebookRequestError.

When I access the object, the only filled properties are: stack, url, method, name, data (with the request payload).

Project setup: Nuxt.js with facebook sdk as a plugin.

Steps/Sample code to reproduce the issue

1 - On a frontend project, make any invalid request and try to access the status/message from FacebookRequestMessage

Observed Results:

{
    "name": "FacebookRequestError",
    "stack": "Error\n    at FacebookRequestError.FacebookError [as constructor] (webpack-internal:///./node_modules/facebook-nodejs-business-sdk/dist/cjs.js:351:16)\n    at new FacebookRequestError (webpack-internal:///./node_modules/facebook-nodejs-business-sdk/dist/cjs.js:373:129)\n    at eval (webpack-internal:///./node_modules/facebook-nodejs-business-sdk/dist/cjs.js:671:15)",
    "method": "POST",
    "url": "https://graph.facebook.com/v14.0/act_removed/adcreatives?access_token=removed",
    "data": removed
}

The lines from the webpack bundle file (cjs.js) represents the following:
351: https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/src/exceptions.js#L18
373: https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/src/exceptions.js#L36
671: https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/src/api.js#L148

Expected Results:

Based on the code, it should be

{
    "name": "FacebookRequestError",
    "message": --- The observed message from Network tab,
    "method": "POST",
    "status": --- The error Code
    "url": "https://graph.facebook.com/v14.0/act_removed/adcreatives?access_token=removed",
    "data": removed
}
@GHSVerde GHSVerde changed the title Cannot access request error response from FacebookRequestError Cannot access request error details from FacebookRequestError Oct 5, 2022
@Gabzmelo
Copy link

Gabzmelo commented Oct 5, 2022

I'm having the same issue too :(

@fuongduyuid
Copy link

fuongduyuid commented Oct 6, 2022

I'm facing similar issue.
I'm trying get the insights of ads/campaigns but repeatedly received this error
CrashReporter: SDK crash detected! Not be able to find appID, fail to send report to server.

Or

Not be able to find appID, fail to send report to server.
Unhandled rejection Error: AdAccount does not yet have an
        associated api object.
 Did you forget to
        instantiate an API session with:
        "FacebookAdsApi.init"?```

@GHSVerde
Copy link
Author

GHSVerde commented Oct 7, 2022

@fuongduyuid I believe your issue is related to configuration other than api response.

My case is about api response and proper FacebookRequestError object translation.

@GHSVerde
Copy link
Author

Is this project abandoned?

@GHSVerde
Copy link
Author

Tested and PR 158 Fixed it. can it still be implemented and tested?

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

3 participants