-
Notifications
You must be signed in to change notification settings - Fork 1.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
S3.putObject doesn't support non-node ReadableStream #2202
Comments
@KidCosmic Are you able to use Blobs? I'm not sure how they differ in react native versus in the browsers, but if they work like the File object in browsers, that may be an alternative way to upload large files. I didn't know react native supported ReadableStream with fetch. Is is officially supported, or provided through a 3rd party package? |
ReadableStream is actually supported by the JavascriptCore, ie, Safari. We're actually shaping another stream into ReadableStream via the ReadableStream constructor:
Doesn't even look like even fetch accepts streams as body arguments, which kinda makes this whole discussion moot, lmao. I'll look at File/Blob but I can't seem to get blobs outside of blobbing a response body. Their constructors are out of the question because of loading into mem. Hmmm... Will most likely have to native this |
You know, we should actually be able to update our ManagedUpload class (used by You're right, I was only able to use a |
That's pretty clever actually. Sounds like it would work to me. 5MB in memory much better than 20 So per the blob suggestion, the pattern works in React Native. XMLHttpRequest accepts a plain js object with There is no explicit formalization of it, just that it works. Possible solution would be in Would love to use Could also take this to Amplify team and have them implement ReadableStream definitely on your turf though.. |
@KidCosmic Could you please share some code of your solution? I'm also running into the same problem trying to upload a large file using stream. |
@ngocketit went with presigned urls. Ask your server for a signed s3 url and do a simple XMLHttpRequest like this:
|
@KidCosmic Thanks for that. It worked! |
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue. |
S3 docs claim that S3.putObject supports ReadableStream
But when used in amplify-js in a React Native app, Readable Stream is not supported.
Currently, streams are only supported in NodeJS environments.
https://github.com/aws/aws-sdk-js/blob/f7728f45dd80c5d4919652720a773d343aaab8af/lib/s3/managed_upload.js#L178
Please expand stream support for ReadableStream as defined by:
https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
Or provide a general definition or interface of ReadableStream.
Feature necessary since streams keep IO at low memory footprint. Currently, loading entire HD videos into memory for an upload is significantly suboptimal.
The text was updated successfully, but these errors were encountered: