-
Notifications
You must be signed in to change notification settings - Fork 24k
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
Failed to parse header with github fetch polyfill library, response.headers.map won't work correctly #11128
Comments
It sounds like your server is buggy, you're supposed to use |
I captured the response with wireshark, the headers' line break is '\r\n' for sure. I believe it is the github fetch library's bug. Our server is nginx + passenger, RoR solution, i don't think the server has this kind of bug. For change's to github fetch library, i will try it. But before that, can we remove dependency for github fetch, drop back to previous fetch implementation? BTW, What's the previous fetch implementation please? If you need a sample project to repro this issue, please let me know, i can try make one and upload to github. Thanks. |
We've depended on whatwg-fetch for a very long time (last change to the corresponding line of package.json in August): https://github.com/facebook/react-native/blame/5d30045211ff1d97cd7005bc268442f3df998b17/package.json Any idea why it only changed for you now? What was your previous RN version? I'm not sure what we used before whatwfg-fetch unfortunately. |
@mkonicek , let me try to repro this issue with a new project. I will notify you once i cloned this issue to a new RN project.
|
I uploaded a test project in github to repro this issue, would you like to have a look? If need any info, please let me know. |
Same issue here. |
The |
Thanks to @fson, i've upgraded the react-native to 0.39 and it is resolved. for those who are using v0.36.0, strongly recommended to upgrade the reac-native to newer than 0.36, or, fix as @fson suggested. @mkonicek , will this issue be patched in v0.36? Should we keep this issue closed or open for later users? |
Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why. |
Issue Description
I have a react native project, pure react native project for android, it has been under development for few months, it works well until i re-installed packages recently.
After i re-install node_modules with
npm install
, the network module won't work correctly anymore. It will failed to parse the response's headers correctly, below code will get undefinedlet {'access-token' : accessToken, client, uid, 'token-type':tokenType} = response.headers.map;
Where the bug is
I dig into the code, and found the root cause is in react-native/node_modules/whatwg-fetch/fetch.js, line 366:
So the split('\r\n') does not work correctly, lead to response.headers.map messed up. My app's authentication depends on tokens from response.headers, it is broken by this error.
What lead to this bug
I compared the react-native/node_modules folders before my reinstall, i found there are something changed after i re-install package.
Before i re-install package, there is no react-native/node_modules/whatwg-fetch, after i reinstall it, the react-native/node_modules/whatwg-fetch comes in, then, my app's network module broken.
Suggestion
Remove whatwg-fetch, or fix the split bug in fetch library.
My enviroment
The text was updated successfully, but these errors were encountered: