0.50.0-rc.2 not working with axios in release build
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS High Sierra 10.13 Node: 8.8.1 Yarn: 1.2.1 npm: 5.4.2 Watchman: 4.9.0 Xcode: Xcode 9.0.1 Build version 9A1004 Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.0-rc.2 => 0.50.0-rc.2
Steps to Reproduce
After upgrading my project to RN 0.50.0-rc.2, all axios call stopped working in release build (they work well in development build and RN 0.49.5).
try {
const res = await axios.get('/news', {
params: { limit: 20, offset: 0 }
})
console.log(res)
} catch (error) {
window.alert(error)
}
I got this exception:
This only happens on RN 0.50.0-rc.2 & production build.
After I changed this line in axios to if (true) {
then it works again in production build. I don’t know why the assertion failed in production build. When I use window.alert(typeof XMLHttpRequest)
in my own code it outputs ‘function’, but it outputs ‘undefined’ in axios code.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8
@alimek Yes, it’s ok in rn 0.50.3。
@Manweill in
package.json
. Anyway you can try update RN to version0.50.3
, they are saying that its fixed, but haven’t tried it yet.