Access Denied for aws S3 image

Hello guys,
I uploaded an image using the upload option in the customise theme section. Two minutes later, I removed the image and uploaded the same image with a new name. Surprisingly, the newly uploaded image picked up the name of the previously uploaded image. Is that a bug ??

So I manually removed the image from S3 storage and once again uploaded the new renamed image. This time the same thing happened again, but this time the S3 link to that particular image is access denied. Also, the new image is not visible in S3 this time.

Any guess guys ??

It’s not a bug. We index uploads based on their content. Same content == same upload.

Well, yeah, because you didn’t remove the upload record in the database.

In order to fix it, you’ll have to find the record and destroy it using the rails console.

7 Likes

Agreed. But I upload the same image again via the customise theme section, but this time the image hasn’t reached the S3. I am not sure, what I am saying is correct or not, since my background is different. But, once you removed an image from S3 manually, then uploaded the same image via discourse, then the image won’t reach S3.

That’s because you didn’t remove the record in the database. Since your file has the same SHA, we don’t upload it to S3 since we already have a record in the database.

1 Like

Is it okay, if I not remove the records from the database ?? Out of curiosity, do discourse have any mechanism to remove broken records periodically?

I came across a similar thread with a problem related to yours, you can check to see if it has just what you are looking for to work out the issue After setting up S3 - Access denied
or the instruction contained here How to Setup Amazon S3 Correct Way for Your Discourse Forum – Setup Auto Image and Backup Upload Both to AWS S3