Specific JS fetch() fails on 0.66.4 (OR: How to debug react-native Android native code?)
See original GitHub issueNew Version
0.66.4
Old Version
0.62.2
Build Target(s)
Android debug and release
Output of react-native info
$ react-native info
info Fetching system and libraries information...
(node:36495) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: macOS 11.6
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 70.23 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.0.1 - /usr/local/bin/node
Yarn: 1.22.1 - /usr/local/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Watchman: 2021.11.01.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
Languages:
Java: 11.0.10 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Issue and Reproduction Steps
I’m trying to call fetch
in a specific point in my application, which succeeded in the previous version and the exact same call succeeds if I try it again and it happens every time. I don’t have a minimal reproducer and I’ve been debugging it for a few hours already.
I’ll note that it does work as expected on iOS.
I’m asking for some help on how to debug the actual react-native native code (not a module), I’ve found my way into sendReqeust()
at ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java
.
The code does log on error:
try {
sendRequestInternal(...);
} catch (Throwable th) {
FLog.e(TAG, "Failed to send url request: " + url, th);
final RCTDeviceEventEmitter eventEmitter = getEventEmitter("sendRequest error");
if (eventEmitter != null) {
ResponseUtil.onRequestError(eventEmitter, requestId, th.getMessage(), th);
}
}
but the logs never appear, I did try using FLog.setLoggingDelegate()
on my react application class with my own delegate (that uses logcat), to no avail.
Ideally I’ll be able to debug react-native code with Android Studio, but since NPM ships a binary rather than source code, it’s not possible. I could dig further to try and understand how to compile the sources but it might take a while so I’m shooting my shot here.
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Yes, thank you.
Android Studio doesn’t recognize that as part of the project’s code, so I can’t place breakpoints in it.
I’ll try the linked guide and keep you updated, thank you.