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 Client] Errors if the Body
of PutObjectCommand
is a Readable
type.
#2348
Comments
Body
is a Readable
type.Body
of PutObjectCommand
is a Readable
type.
Same here. From googling, the error is thrown when the Working version: const { data: fileStream } = await axios.get(url, {
responseType: 'stream',
})
const params = {
Bucket: 'bucket',
Key: 'key',
Body: fileStream,
}
await s3.upload(params).promise() Broken version: const { data: fileStream } = await axios.get(url, {
responseType: 'stream',
})
const params = {
Bucket: 'bucket',
Key: 'key',
Body: fileStream,
// Uncommenting ContentLength makes it work.
//ContentLength: 123,
}
await s3.send(new PutObjectCommand(params)) Error msg:
|
I'm running into the same issue. In v2 of the SDK you could easily upload streams of unknown length through Pretty big regression, I would say, just because of this I have to revert back to v2 of the SDK as there is no other way to easily upload streams of unknown length. |
Hi @fabis94 @yaquawa @guanzo, The error is indeed caused by stream length remaining unknown. We need to improve the error message and the documentation. As it's pointed out in the Upgrading Guide, the similar functionality as |
Aha, so this is intended behavior. I did not check the upgrade guide. Thanks for the update! |
Just in case anyone needs a clear answer: |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Describe the bug
I got this error when I set the
Body
to aReadable
type.SDK version number
3.13.1
To Reproduce (observed behavior)
I could confirm that it's ok if I change the
Body
to a string, so I'm sure I have the right permission to put an object to the bucket.The text was updated successfully, but these errors were encountered: