Network requests silently fail in Android since v0.63.0
See original GitHub issueDescription
None of the network examples work in Android since v0.63.0; iOS is unaffected. Confirmed this is still an issue in v0.63.1 and v0.63.2 (the latest as of this report). Failures are silent and simply result in no data being returned to the view.
Since this is an issue with the network APIs, this affects all libraries that rely on those APIs, e.g., Apollo.
React Native version:
System:
OS: macOS 10.15.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 960.03 MB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.18.2 - /var/folders/tb/wx5d6rj53qjdg6sr4bmb1l840000gn/T/yarn--1597082804831-0.5290956210609348/node
Yarn: 1.22.4 - /var/folders/tb/wx5d6rj53qjdg6sr4bmb1l840000gn/T/yarn--1597082804831-0.5290956210609348/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.6/11E708 - /usr/bin/xcodebuild
Languages:
Java: 11.0.8 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
- Install the last known good version:
npx react-native init AwesomeProject --version 0.62.2
- Replace the contents of
App.js
with one of the examples from the network docs, e.g., the Fetch Example. - Run the application in iOS.
npx react-native run-ios
- Note that the fetch example displays as intended.
- Run the application in Android.
npx react-native run-android
- Note that the fetch example displays as intended.
- Install latest (v0.63.2 as of this report):
npx react-native init AwesomeProject
- Replace the contents of
App.js
with one of the examples from the network docs, e.g., the Fetch Example. - Run the application in iOS.
npx react-native run-ios
- Note that the fetch example displays as intended.
- Run the application in Android.
npx react-native run-android
- Note that a blank screen is rendered.
Expected Results
The results should be rendered as they are on iOS and as they are on versions prior to v0.63.0. At the very least, would expect to see the activity indicator and possibly an error indicating the request failed.
Snack, code example, screenshot, or link to a repository:
Issue Analytics
- State:
- Created 3 years ago
- Comments:28 (2 by maintainers)
Top Results From Across the Web
Andrei Alecu on Twitter: "The story of how Reddit had to revert its ...
HTTP requests in React Native Android to hosts that advertise IPv6 can get stuck ... Network requests silently fail in Android since v0.63.0...
Read more >Network Request failed - React Native - android - Stack Overflow
I changed the port of my own server to 19001 and it worked for me. If you are developing your own server maybe...
Read more >React Native v0.63.x released
v0.63.0. Breaking. The target field of events is now a native component, not a react tag (3b813cade1 by @TheSavior); Modal: Remove support ...
Read more >CHANGELOG.md ... - GitLab
Quarantine UsageDataNonSqlMetrics failing test (merge request) ... scan form after editing a DAST profile (merge request) GitLab Enterprise Edition ...
Read more >CHANGELOG.md · 14.6-thm · projects.thm.de / GitLab FOSS · GitLab
Open in Web IDE ... Limit commands_changes to certain keys (merge request) ... 30 days after subscription expires (merge request) GitLab Enterprise Edition ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
More info: If we invoke Metro via
yarn
in our monorepo, it seems to “poison” the Metro cache. Runningyarn react-native --reset-cache
in the monorepo has no effect. We have to create a demo app with the same package name to clean it, e.g.,npx react-native init <ourproject> && cd <ourproject> && npx react-native start --reset-cache
, then the app works again. It appears Metro caches based on the project name, is that accurate?Also, while this workaround works for the development builds, the release builds still have no network connectivity, e.g.,
npx react-native run-android
works but notnpx react-native run-android --variant=release
.Edit: Running a release build also appears to “poison” the Metro cache.
@cristianoccazinsp Here is a Gist with the relevant code excerpt:
https://gist.github.com/danmaas/c60af5fed9f55d2bc616ce302696540d
This overrides the default OkHTTP client factory with a shim that intercepts DNS resolutions and sorts the result list to return IPv4 addresses before IPv6 addresses.