-
-
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
Migrate from s3 sdk v2 to v3 #6731
Conversation
Need to polish about |
Appreciate the help here 🙏 |
package.json
Outdated
@@ -47,6 +47,11 @@ | |||
"> 0.25%, not dead" | |||
], | |||
"dependencies": { | |||
"@aws-sdk/client-s3": "3.535.0", | |||
"@aws-sdk/lib-storage": "3.535.0", | |||
"@aws-sdk/s3-presigned-post": "3.535.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My local env can work without importing @aws-sdk/s3-presigned-post
as expected. But CI cannot find this module so I imported it here. Don't know the root cause and I found a similar issue with aws-sdk/middleware-endpoint
before(aws/aws-sdk-js-v3#3983).
region: env.AWS_REGION, | ||
endpoint: this.getEndpoint(), | ||
signatureVersion: "v4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is deprecated and now is replaced by import "@aws-sdk/signature-v4-crt";
according to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt
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 |
server/storage/files/S3Storage.ts
Outdated
try { | ||
return this.client | ||
.getObject({ | ||
this.client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response is no longer returned, can we restore this to async/await style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in d520b03
(#6731) . I'm not so familiar with all promise, await, and async things. Please feel free to correct me if I'm doing wrong.
From my local test, it's been fixed by |
I really don't want to change the signature of the storage interface here, it's weird to have a method called |
I assume this means using async/await in |
I think you're right, this is a terrible limitation of the new version – how annoying. |
invariant( | ||
env.AWS_S3_UPLOAD_BUCKET_NAME, | ||
"AWS_S3_UPLOAD_BUCKET_NAME is required" | ||
); | ||
|
||
this.client | ||
return this.client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seemed to be a bug – nothing returned here, but with this change I think it's ready to merge
…97bcc by renovate (#23333) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [outlinewiki/outline](https://togithub.com/outline/outline) | minor | `0.76.1` -> `0.77.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>outline/outline (outlinewiki/outline)</summary> ### [`v0.77.0`](https://togithub.com/outline/outline/releases/tag/v0.77.0) [Compare Source](https://togithub.com/outline/outline/compare/v0.76.1...v0.77.0) #### What's Changed This release changes how documents are rendered, allowing the introduction of new editor functionality and attributes. Highlighted for this release are some big improvements to tables: ![image](https://togithub.com/outline/outline/assets/380914/6109e4a5-fc5a-4a25-ae33-eebbe9adc0db) - **Column resizing:** You can now resize columns by dragging the border between them - **Full-width tables:** Tables now expand to the full width of the editor - **More content:** Table cells now support embeds, code blocks, and all other content types - **Toggleable headers:** You can now toggle a header row and column - **Improved overflow:** Tables now scroll horizontally when they're too wide for the editor - **Improved row and column controls**: We've made it one click to add rows and columns ##### Other improvements - Added more highlighter color choices in [outline/outline#7012 - New collection permissions UI in [outline/outline#6917 - Big rendering performance improvements for documents with many images - Add `Manage` permission to documents allows other users to manage sharing in [outline/outline#7003 - Added an embedded Yandex Maps component by [@​shashinma](https://togithub.com/shashinma) in [outline/outline#6881 - Added a permission selector in document/collection invite flow in [outline/outline#6948 - Added support for embedded youtube clips by [@​Pranav2612000](https://togithub.com/Pranav2612000) in [outline/outline#6942 - Matomo integration in [outline/outline#7009 - `/` block insert shortcut now works anywhere on a line or table in [outline/outline#7026 - Added the ability to remove a previously uploaded team logo or profile picture - Added a menu option to create template directly in collection ##### Fixes - Various fixes to improve the fluidity of app loading - Image placeholders are now correctly sized when uploading retina images - Images and PDF's are now served with inline content disposition in [outline/outline#6924 - Added support for Figma's new link formats and Figjam boards by [@​RenderCoder](https://togithub.com/RenderCoder) in [outline/outline#6946 - `files.get` now supports range header, fixes video loading in Safari in [outline/outline#6950 - Fixed an issue where zoomed images could get stuck in [outline/outline#6980 - Share button was removed on templates - Fixed race condition that could result in document emoji not saving - Removed trust of `state.host` in auth error redirect - Collapsed sidebar now works better in Arc/Edge redesign #### New Contributors - [@​shashinma](https://togithub.com/shashinma) made their first contribution in [outline/outline#6881 - [@​lng2020](https://togithub.com/lng2020) made their first contribution in [outline/outline#6731 - [@​RenderCoder](https://togithub.com/RenderCoder) made their first contribution in [outline/outline#6946 - [@​Frzk](https://togithub.com/Frzk) made their first contribution in [outline/outline#6971 - [@​bkrausz](https://togithub.com/bkrausz) made their first contribution in [outline/outline#7022 **Full Changelog**: outline/outline@v0.76.0...v0.77.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MDcuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQwNy40IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImF1dG9tZXJnZSIsInVwZGF0ZS9kb2NrZXIvZ2VuZXJhbC9ub24tbWFqb3IiXX0=-->
* chore: migrate from s3 sdk v2 to v3 * import signature-v4-crt * downgrade minor version * Add s3-presigned-post manually * Change s3 mock * Update server/storage/files/S3Storage.ts * docs * Upgrade aws-sdk --------- Co-authored-by: Tom Moor <tom.moor@gmail.com>
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 acontent-length
field to be set, which is discussed in aws/aws-sdk-js-v3#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 theUpload
class from@aws-sdk/lib-storage
which is compatible with v2.