outline
outline copied to clipboard
Migrate from s3 sdk v2 to v3
close #5683. Nothing breaking, test with my local setup and everything works.
Noticeable change:
The s3 SDK v3 method PutObjectCommand doesn't support stream input and it requires a content-length field to be set, which is discussed in https://github.com/aws/aws-sdk-js-v3/issues/2348.
So I didn't use PutObjectCommand because I think loading whole files into the buffer may cause a burden. As the issue comment above suggests, I use the Upload class from @aws-sdk/lib-storage which is compatible with v2.
Just in case anyone needs a clear answer: putObject can't write a stream to S3, you have to use the Upload class in @aws-sdk/lib-storage
Need to polish about signature-v4-crt
Appreciate the help here 🙏
ready for review
So, there is a bug here – when downloading a document that includes an embedded image (Document -> ... -> Download -> Markdown), the image in the generated zip file is 0 bytes.
This would suggest that getFileStream is not working correctly. I checked out main to test it continues to work correctly there.
So, there is a bug here – when downloading a document that includes an embedded image (Document -> ... -> Download -> Markdown), the image in the generated zip file is 0 bytes.
From my local test, it's been fixed by d520b03 (#6731). There is a long discussion about this getObjectComand https://github.com/aws/aws-sdk-js-v3/issues/1877 about this inflexibility command :smile: and It seems required to use the Readable type. Let me know if there are other malfunctions or other improvements.
I really don't want to change the signature of the storage interface here, it's weird to have a method called getFileStream that returns a promise :/ It feels like it was very close before the last round of changes with the exception of that one issue
can we restore this to async/await style?
I assume this means using async/await in getFileStream and results in a promise returned so I change the signature. Could u kindly specify what the right approach is?
I think you're right, this is a terrible limitation of the new version – how annoying.