Storage.put fail with large files on Android with react-native
See original GitHub issueStorage.put need a blob to upload file.
But react-native has a fetch bug on android with “big” files. You can see here
When you try to uplaod video with size of 160mb or more, const response = await fetch(videoUri)
get next error: TypeError: Network request failed
(It isnt network error, with small sizes it work).
I have tried to generate the blob with https://github.com/joltup/rn-fetch-blob but I have not been able to make it works.
Is there a way to get it working or an alternative way to upload large files?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Scoped Storage in React Native: New Android 10 API for File ...
Since the release of Android 10, Google has made Scoped Storage the default way to access files on an Android device but up...
Read more >Write files to the Android external storage using React Native FS
First, with RNSF we need to download the file and set the destination at RNFS.TemporaryDirectoryPath , then copy the downloaded file with react- ......
Read more >Uploading large files (videos) > 1GB directly from device ...
Hello, I am trying to implement a feature, which allows users to upload large video files from their device storage.
Read more >Cloud Storage | React Native Firebase
Your files are stored in a Google Cloud Storage bucket. The files in this bucket are presented in a hierarchical structure, just like...
Read more >Uploading Files and Images to Firebase Cloud Storage in ...
That was how you can upload any file on Firebase Cloud Storage and list the files from Could Storage from React Native App...
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
Update: I have a working implementation locally now that doesn’t give the OOM error and should solve the UI freezing problem, its also significantly faster than before. Once I have properly tested it I will submit a PR.
Hey folks, I started doing some research on this issue and here’s what I found.
The issue likely stems from here: https://github.com/aws-amplify/amplify-js/blob/main/packages/storage/src/providers/AWSS3ProviderManagedUpload.ts#L316 As a work around for using Axios on React Native (They don’t support React native blobs). We implemented a change where we will transform the blob into an arrray bufer first. When the file is large enough it will hog all the memory which causes an OOM exception.
On top of that, during the transformation it freezes the UI.
Currently working on a fix, will give more updates soon.