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

S3 Versioning #480

Open
barth12 opened this issue May 22, 2023 · 2 comments
Open

S3 Versioning #480

barth12 opened this issue May 22, 2023 · 2 comments

Comments

@barth12
Copy link

barth12 commented May 22, 2023

I am using the Serverless Image Handler, which utilizes a CloudFront distribution to cache images. My origin S3 buckets have versioning enabled. However, I have encountered an issue where CloudFront does not respect the versionId query parameter and always retrieves the latest version of an image. Or maybe CloudFront respect that but Lambda does not?

I have taken the step of configuring CloudFront to pass the versionId query parameter, but unfortunately, it does not seem to be working as expected. I'm unsure of what I might be missing or if there is something else I need to consider. Could you please provide some guidance or suggestions on how to address this issue?

@dougtoppin
Copy link
Contributor

dougtoppin commented Dec 3, 2023

@barth12 Serverless Image Handler does not currently support the ability to manage versions of the original image. We will add this to the backlog to review if support might be added.

@dougtoppin dougtoppin added enhancement and removed bug labels Dec 4, 2023
@simonkrol
Copy link
Member

Hi @barth12,
This isn't something we currently plan to implement. However, if you'd like to implement it yourself, the following is what I would expect would need to be changed:

  • queryStringBehaviour would need to allow the version query parameter for both cache and originRequestPolicy. Location
  • The ImageHandlerEvent queryStringParameters interface should include version. Location
  • You'd have to extract the version query parameter out of the request in the setup method
    • That value would need to be passed into the getOriginalImage call.
  • In the getOriginalImage call, include the VersionId parameter in the imageLocation object used to make the request. Location
    • It's worth noting that the backend lambda would require the s3:GetObjectVersion permission for that object, though that is included by default in the current version of SIH.

Let me know if that ends up working for you,
Simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants