-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Networking fetch - Failed to execute 'readAsText' on 'FileReader' parameter 1 is not of type 'Blob'. #15325
Comments
Is there a particular json that triggers this? Try fetching other json-formatted documents and see if the error appears. ¯_(ツ)_/¯ |
@hramos Thanks for responding, I truly appreciate it. |
Also just to be clear, I am allowing Arbitrary Loads in my Info.plist, but that should already be obvious because it doesn't work with https either. |
Tried as well with the facebook movies.json example to no avail. Fixed by switching to react-native-fetch-blob and making a standard GET request |
This seems to be an issue when using a remote JS debugger - the body has already been used so try {
return await response.json();
} catch(e) {
return JSON.parse(response._bodyBlob.data);
} |
I'm having the same problem after upgrading to react-native: 0.51.0 worked ok with 0.44.0. Currently using the workaround (thanks @rh389) and am considering using react-native-fetch-blob. Does this mean that we cant use fetch at all anymore, without the workaround? I'm guessing it must still work for some people as I'm sure there would be more comments about it here. To confirm I'm having the same problem with any api call returning json whilst the debugger is active using the IOS simulator. react-native: 0.51.0 |
Is this a bug report?
Yes
Have you read the Bugs section of the How to Contribute guide?
Yes
Environment
react-native -v
: 0.43.3node -v
: v7.6.0npm -v
: 5.3.0yarn --version
:Then, specify:
Steps to Reproduce
Getting response.json() from GET request causes the error.
Expected Behavior
I thought I'd get the JSON from the link. I'm actually trying to use localhost, but I used Reddit to see if it still occurred with HTTPS, which it does.
Actual Behavior
I received the error in the title after the '-' and got the following stacktrace (note the link definitely returns json):
Reproducible Demo
¯\_(ツ)_/¯
The text was updated successfully, but these errors were encountered: