Post new file with API with S3 storage enabled

Hi there,

I’m making a new Omeka site set with Amazon S3 storage, and I’m having trouble uploading new files with the API. I am able to upload files in the browser, and if I disable S3 storage, I am able to upload with the API.

I’m using the https://github.com/jimsafley/omeka-client-py api python class. My site’s error_log displays this message:

[16-Nov-2021 22:14:12 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/watzekdi/ethan.watzekdi.net/application/libraries/Omeka/File/MimeType/Detect/Strategy/Browser.php on line 22

Here is my python code:

from omekaclient import OmekaClient

client = OmekaClient("[url]/api", "[key]")

response, content = client.post_file('{"public":true, "item": {"id":148}}', 'test.txt', 'test.txt')

Here is the python/API output:

{'connection': 'Keep-Alive', 'content-type': 'application/json', 'vary': 'Accept-Encoding', 'content-length': '35', 'date': 'Tue, 16 Nov 2021 21:46:13 GMT', 'server': 'LiteSpeed', 'alt-svc': 'quic=":443"; ma=2592000; v="39,43,46,50", h3-Q039=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-23=":443"; ma=2592000, h3-24=":443"; ma=2592000', 'status': '500', '-content-encoding': 'gzip'} b'{"message":"Unable to store file."}'

This works when S3 storage is not enabled.

I would appreciate any advice in diagnosing/solving this issue, thanks!

–Ethan

I’m not sure that warning is related, though it’s possible.

Two questions: what version of Omeka are you using, first off? And, what’s the actual symptoms, what’s returned from the API and/or reported by Python?

Sorry for omitting the python output, I’ve updated the original post to include it. I’m using Omeka 2.8.

It turns out the issue was with S3 permissions, not Omeka. My bad!