c2corg / v6_images

Images handling app for c2c.org v6
GNU Affero General Public License v3.0
1 stars 2 forks source link

Error testing files with v6.1.0 #41

Open asaunier opened 6 years ago

asaunier commented 6 years ago

We recently pushed release v6.1.0 to camptocamp.org prod but we have observed errors when "publishing" images: uploading and thumbnails creating work but the photo backend returns a 500 error when moving files from "incoming" to "active".

The logs say:

ERROR c2cwsgiutils.errors POST http://haproxy.exoscale.infra.camptocamp.org:8081/publish returned status code 500: An error occurred (403) when calling the HeadObject operation: Forbidden images_1    |   File "/app/c2corg_images/views.py", line 114, in publish images_1    |     already_published = active_storage.exists(filename) images_1    |   File "/app/c2corg_images/storage.py", line 119, in exists images_1    |     raise e images_1    |   File "/app/c2corg_images/storage.py", line 101, in exists images_1    |     object.load()

See https://github.com/c2corg/v6_images/blob/master/c2corg_images/views.py#L114 https://github.com/c2corg/v6_images/blob/master/c2corg_images/storage.py#L101

A hint found by @gberaudo: the file does not exist but the storage returns a 403 code instead of 404 as expected by https://github.com/c2corg/v6_images/blob/master/c2corg_images/storage.py#L116

It seems that S3 indeed returns 403 code when a file is missing. The weird thing is that it worked on the demo site whose storage is also S3 (?).

arnaud-morvan commented 6 years ago

The file storage return 403 instead of 404 for GET request, nothing to do with HeadObject operation. I've tested locally and the HeadObject operation return 404. Note that this is tested locally, but skipped on travis.