question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storage.put fail with large files on Android with react-native

See original GitHub issue

Storage.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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jamesaucodecommented, May 20, 2021

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.

2reactions
jamesaucodecommented, May 20, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found