Running example code results in network error at RN fetch()
See original GitHub issueFirst of all: Thanks for this project!
I am checking out the /example
code and when running as described in the README and without modifications I get following error:
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (fetch.js:441)
at XMLHttpRequest.dispatchEvent (event-target.js:172)
at XMLHttpRequest.setReadyState (XMLHttpRequest.js:546)
at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:381)
at XMLHttpRequest.js:485
at RCTDeviceEventEmitter.emit (EventEmitter.js:181)
at MessageQueue.__callFunction (MessageQueue.js:260)
at MessageQueue.js:101
at MessageQueue.__guard (MessageQueue.js:228)
at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:100)
I will look into this further, but maybe there is something obvious I am overlooking…
(Versions: yarn 0.24.6, npm 4.2.0, ubuntu 16.04, (local) node: 7.10.1)
PS I will try again with downgraded node on ubuntu system
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:21 (4 by maintainers)
Top Results From Across the Web
React Native fetch() Network Request Failed - Stack Overflow
I was using localhost for the address, which was obviously wrong. After replacing it with the IP address of the server (in the...
Read more >Error Handling for Network Requests in Client-Side JavaScript ...
We have an err object, representing the Error that Axios creates for us, but the error message is generic: “Request failed with status...
Read more >Networking - React Native
React Native provides the Fetch API for your networking needs. ... The above examples show how you can make a request.
Read more >request failed with status code 400 react native - You.com
React Native API fetch error Request failed with status code 400 ... api/zomato'; export default () => { const [results, setResults] = useState([]); ......
Read more >react-native-blob-util - npm
Start using react-native-blob-util in your project by running `npm i ... React-Native-Blob-Util is fully compatible with RN-Fetch-Blob and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop 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
Top GitHub Comments
Hi @staltz
I got it working by refactoring to J2V8:
Steps:
python build.py --interfactive
(using the not-yet-merged build improvement PR)j2v8-release.aar
inreact-native-node
(8.7 MB, Node7.9.0
for me, soon8.1.2
)compile project(':j2v8-release')
android/app/src/main/assets
(will refactor this to be./Background
)Then
RNNodeService.java
like this:(PS You don’t need a
V8Thread
. A normal one will do)For some reason I had to redefine
RNNodeModule.start
to have no parameters when called with no parameters from RN, otherwise I ended up with errorNativeArgumentsParseException got 0 arguments expected 1
. Will look into this later.I now know much more on J2V8 now (see Viable options to running NodeJS on Android (Aug 2017)) and am convinced that both react-native-node and node-on-android would benefit by using this as a basis to build on further. It would not add any overhead in the way the project is working now, and gives some powerful options in e.g. communicating between RN and Node.
I will keep you posted on more findings.
This is current status: https://github.com/eclipsesource/J2V8/issues/332 May be solved when J2V8 is ready to build Node 8.4.0 (which is almost)