-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Storage.put fail with large files on Android with react-native #6419
Comments
@luisfuertes are you still looking for support on this issue? If so, please provide us information on your environment by running the following command: |
I am also getting the same error, here is the requested information:
Here in the above code
fails with Try to upload a file more than 300mb. Logcat shows OutOfMemory exception. |
My workaround was upload with formdata and upload to bucket url generated by my backend.
And upload video with axios:
|
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems. |
@sammartinez can you check this? |
Hi, I'm facing the same issue, |
This part is the bug in react-native:
|
I'm having the same issue. Uploading for small files works, for file of size 5.7 MB it fails. Using Amplify 4.19.0 |
Here is my observation const response = await fetch(pathToImageFile) Fails with Out of memory exception, can be found using |
I have the same issue. Did anybody solve this ? |
Here is a small wrapper I created, using the Storage plugin. It supports reading files in chunks. https://github.com/walvekarnikhil/amplify-s3-chunk-upload |
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 On top of that, during the transformation it freezes the UI. Currently working on a fix, will give more updates soon. |
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. |
@jamesaucode |
@jamesaucode The problem is still present (although indirectly) when e.g. trying to upload 100MB+ media on Android. According to the docs here https://docs.amplify.aws/lib/storage/upload/q/platform/js/#react-native-uploads, we should still use fetch before uploading. This part with fetch is, simply, broken in React Native. So Storage.put() can support uploading big files, chunks, etc, Would be really nice, if Storage.put method supported something like fileUrl parameter instead of fileContent blob (as it is now). |
Hi Everyone, |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
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?
The text was updated successfully, but these errors were encountered: