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 Active Storage Images Expiry problem #3670

Open
rctneil opened this issue Feb 17, 2025 · 0 comments
Open

S3 Active Storage Images Expiry problem #3670

rctneil opened this issue Feb 17, 2025 · 0 comments

Comments

@rctneil
Copy link
Contributor

rctneil commented Feb 17, 2025

Hi @adrianthedev

As I mentioned in the recent Avo Office Open Hours session, I said i'd post an issue about a problem we're hitting with some Active Storage images on S3.

I am confident this is not an Avo issue so I apologise for posting but we're running out of places to find some guidance from with this.

We have some assets uploaded to S3 in as simple a method as we can. We output them with:

<%= image_tag post.image if post.image.attached? %>

The bucket is set up as default with an IAM user configured with full access.

On initial page load the images show correctly. After a period of time, when we do a soft reload the images fail. If I open them in a new tab I see output like:

<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<X-Amz-Expires>300</X-Amz-Expires>
<Expires>2025-02-14T16:13:58Z</Expires>
<ServerTime>2025-02-17T11:17:06Z</ServerTime>
<RequestId>EJM6KNDFJ67SKJMS</RequestId>
<HostId>zRks9h73we+XUZwf957qiwun3tFPyfhv7reGsjzfSz0tX57r7rNroD7a8cCPnw1kiyWjX1CSnZ+c8=</HostId>
</Error>

When we check the network panel we see:

Image

I understand that S3 assets do expire, but want to know why performing a soft refresh (what a regular user would do) does not generate a new valid image access?

Doing a hard refresh does show the image correctly.

Really struggling to understand this one. I do hope you can shed some light onto it for us.

Thanks in advance!

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

No branches or pull requests

1 participant