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

Successful API Call not resolving correctly after http status 200 #12

Closed
perengb opened this issue Nov 15, 2017 · 2 comments
Closed

Successful API Call not resolving correctly after http status 200 #12

perengb opened this issue Nov 15, 2017 · 2 comments

Comments

@perengb
Copy link

perengb commented Nov 15, 2017

I'm getting this error thrown after the SDK has made a successful API-call (when checking network in Chrome devtools the API-call was successful and the correct data was returned from the API).

TypeError: Cannot read property 'error' of undefined
at new FacebookRequestError (cjs.js:339)
at eval (cjs.js:466)
at ZoneDelegate.invoke (zone.js:391)
at Object.onInvoke (core.es5.js:3890)
at ZoneDelegate.invoke (zone.js:390)
at Zone.run (zone.js:141)
.....

I've debugged the SDK and the problem seems to be in the XmlHttpRequest request method in http.js on line 54, request.status is a number 200 for me and HTTP_STATUS.OK is a string "200" so the types doesn't not match and the promise is incorrectly rejected even thought the http request was successfull:

if (request.status === HTTP_STATUS.OK) {
resolve(response);
} else {
reject(
new Error({
body: response,
status: request.status
})
);
}

@zanyaziz
Copy link
Contributor

Can you send a PR out with a fix?

@zanyaziz
Copy link
Contributor

Fixed the issue in the latest code push.

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

2 participants