-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
React Native 0.62.* [TypeError: Network request failed] on file upload #28551
Comments
Same problem here! |
Same problem !! I am stuck on this issue from last 2 days! Searched almost everything.. |
You need to add this
According to docs
|
I have tried it already. This is used when you are making request to a http server, but my server is running on https. It was running perfectly before upgrading to 0.62. |
All other requests are working perfectly. Only file uploads are not working anymore. |
I faced too many issues when I tried upgrading to 0.62 even though I created a new app and moved my code into it. I rolled back to 0.61.5 till it gets stable :/ |
I am facing the same issue, for RN 0.62.0 and 0.62.1 throws this error: |
I moved back to 0.61.5 :( No other choice left for now. If anyone needs help in downgrading to 0.61.5, refer to react-native-upgrade-helper. |
Same happens here! |
I faced same issue, it happens in Android, but works well in IOS. For while, I commented in this file |
This issue occurs also on my end, and guess what it is only occurring in debug mode. Tried building in internalRelease and it works fine. I guess it is because of the auto/fast reload in debug mode which applies some flipper communication which seems to be related in this issue.. Another issue here is that there is no error in android logcat.. I've also spent some days researching how to fix this issue still no luck. |
Whoever is still struggling with this issue. it's happening because of Flipper network plugin. My workaround to make this work is commenting out line number 43
in this file |
Thanks for the issue @abumostafa. Does this occur in a fresh React Native template out of the box? If so this should be looked at otherwise feel free to close it. |
|
|
This still occurs in latest fresh React Native template 0.62.1 |
@safaiyeh |
Hi , If you upload image set type : 'image/jpeg', |
Hey @abumostafa, What in the case of managed workflow like Expo where there is no access to native project files, what could be the possible solution in that case ? |
I've got it please refer this resolution in case of Expo's managed workflow. |
This issue solved in react-native 0.63.3+ |
Ok, So I feel the point is made clear that the issue is while trying to send invalid file validated attributes like invalid file uri, type or in case some missing required data attributes like name, while the issue being resolved. |
Hello. I am facing a problem from past 2 days in android that whenever I try to hit an api through axios by simply sending a formdata I get a network error. I have updated to expo sdk 41 and react native version 0.63.3 but it still it gives me this error. I need urgent help. |
Still having same issues in RN 64.1 |
@mirfanahmed and @kylanhurt I fixed this issue by hard coding the file type extention. Take a look at the
|
This works for me |
I am getting this issue now on 0.64.2. Uninstalling Flipper is not working either. Anytime I make a network request (not just file upload) I get iOS works fine. Edit: Managed to isolate the issue to a dependency that we are using. |
@quachdev Try |
Tried and no luck. Same result. Have tried to invalidate cache and restart as well on Android Studio. |
Same issue exists. The API call is working in a real device, but not in the emulator. Now, my concern is, Should I worry that it doesn't work on emulator? It will be good if someone can answer this question, so that I can work with the real device until this issue is sorted out. |
I'm facing this issue i've literally tried everything |
same issue I have tried all the solutions but doesn't work while the file is part of the append throws a network error ` let body = new FormData()
|
Can you guys update your comments with the code you're trying to execute. |
Can you guys please help me, I'm struggling with this, I tried all the way, but my code still sends [object Object] to server? |
What file is this logic in? Is it in the file with the component that's selecting the image from the file system or a separate file? @tohshine |
Update the comment with your RN code @thanhhai16 |
react native 0.64
|
Check first if your upload works with very small files ( for example, instead of uploading a video, upload a gif ). In my case, any file over 1 MB would return "TypeError: Network request failed". After many attemps, it turns out that the problem was caused by me using localtunnel, which limited my maximum file size. |
i getting this in RN 0.64 , while i individually upload image or video but when i upload with image and video text it works fine |
@abumostafa - legend. Two weeks. Two weeks of scratching my head why file uploads were working absolutely fine in iOS, but wouldn't work in Android. Commenting a single line in a dev-only relevant file makes it work. Incredible. I love my life. |
i face same issue in RN 0.65.1. why close the issue? have any solution? |
@princefishthrower - @abumostafa solution works for Android, how did you manage to resolve it for iOS? We are also facing this issue in iOS |
@juggernauts In my case the file upload endpoint (sendbird chat profile upload if it helps) was working on iOS well before I did this "fix". To help further, I use the const result = await ImagePicker.openPicker(imagePickerOptions);
const file = {
uri: result.path,
type: result.mime,
name: "anyStringHoweveryouWantToDefineTheFileName",
}; Also, I had a huge typo in my comment, this fixed file uploads for Android - iOS was working the whole time. Sorry for any confusion that may have caused! The good news is if you have Android working, iOS should be easier - at least that's how it was in my case. |
Every Time.even in rn 0.65 |
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
After upgrading from 0.61.4 to 0.62.0 the app will not upload files anymore from Android (all other requests are working fine)
React Native version:
0.62.0
Steps To Reproduce
fetch
Expected Results
The request should reach the server to upload the file
Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/01W!bybf_
[Mon Apr 06 2020 21:29:18.704] LOG [TypeError: Network request failed]
The text was updated successfully, but these errors were encountered: