Skip to content
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

[AWS S3 Uploader] Allow retrieving Object Version ID #5138

Open
2 tasks done
ninanator opened this issue May 2, 2024 · 3 comments · May be fixed by #5195
Open
2 tasks done

[AWS S3 Uploader] Allow retrieving Object Version ID #5138

ninanator opened this issue May 2, 2024 · 3 comments · May be fixed by #5195
Labels
AWS S3 Plugin that handles uploads to Amazon AWS S3 Feature

Comments

@ninanator
Copy link

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

AWS allows retrieving the version from versioning-enabled buckets with the x-amz-version-id response header (Read more).

For multi-part uploads, I am able to retrieve the version ID because I control the response with completeMultipartUpload. However, I am unable to retrieve this information while following the recommendation that files under 100 MiB are uploaded in a single chunk.

I would like to be able to access the version ID at the time the upload finishes for all upload types.

Solution

I think the easiest path would be to add versionId as an optional field on UploadPartBytesResult and populate in

const location = xhr.getResponseHeader('Location')

Alternatives

Always upload files in multiple parts, regardless of size

@Murderlon
Copy link
Member

@aduh95 maybe it would be nice to let users control what is returned in both multipart and non-multipart, instead of hardcoding it?

@aduh95
Copy link
Member

aduh95 commented May 3, 2024

I suppose we could use xhr.getAllResponseHeaders() and pass the result directly to the user, which can then cherry-pick what they need from it. Do you think that would fulfil your usecase @ninanator?
I suppose it would only returns the headers that are allowed by CORS, but that's something the user controls.

@ninanator
Copy link
Author

@aduh95 @Murderlon

Returning all of the headers would be amazing!

To be honest, having a companion method like completeMultipartUpload for uploads initiated via getUploadParameters which has access to xhr.getAllResponseHeaders() would be the absolute best because I could then normalize what comes back to the body field of Success Response on the listener uppy.on('upload-success', ...) across all upload types.

@Murderlon Murderlon added the AWS S3 Plugin that handles uploads to Amazon AWS S3 label May 6, 2024
@Murderlon Murderlon linked a pull request May 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS S3 Plugin that handles uploads to Amazon AWS S3 Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants