Open rcp522 opened 1 year ago
Replicated the issue and both Expo and React Native CLI apps crashed when uploading 1GB file in iPhone 14 Pro. No crash in the iOS Simulator using Expo (iPhoneSE) but it did crash with React Native CLI using the same simulator when uploading 1GB file.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, Storage
Amplify Categories
auth, storage
Environment information
Describe the bug
Attempting to upload large files (1/5/10 gig) either has a network timeout (with Expo) or seems to run out of memory when created using React Native CLI. The app constantly crashes at 600mb ish for me. The files also take longer to upload (if you would compare it to a React application).
The cause for this looks like the way the file is uploaded. In order to pass the file from React Native to Amplify, the file needs to be read as a blob
const blobFiless = await response.blob();
which loads the whole file in memory, so, the whole file is kept in memory while it is being uploaded. This increases memory usage especially for larger files and this sometimes causes the app to crash. In pure React, the file is streamed which is faster and does not produce issues.This issue seems related to this one for android https://github.com/aws-amplify/amplify-js/issues/9736
Expected behavior
Ability to upload large files and as fast as the React implementation.
Reproduction steps
For Expo CLI:
For React Native CLI:
Code Snippet
Expo CLI
Package.json
React Native CLI
Package.json
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
Iphone14 Pro Max
Mobile Operating System
iOS 16.1
Mobile Browser
Stock (Safari)
Mobile Browser Version
Not sure, running in the Simulator
Additional information and screenshots
No response