Max POST error on API call

Hi, I’m experiencing " POST request exceeded maximum size" error on Red Hat when running dockerised Omeka-s (https://github.com/artturimatias/omeka-s-docker-npm). Docker setup works on Debian but with RHEL I can’t make POST requests (Omeka works otherwise so there is db connection and I can make GET requests to api).

I can’t make POST request even from inside container.

I know that this is not an Omeka issue but maybe some one could give a hint where the problem could be.

Omeka S encountered an error

Omeka\Mvc\Exception\RuntimeException
POST request exceeded maximum size

Details:

Omeka\Mvc\Exception\RuntimeException: POST request exceeded maximum size in /var/www/html/application/src/Mvc/MvcListeners.php:257
Stack trace:
#0 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Omeka\Mvc\MvcListeners->checkExcessivePost(Object(Zend\Mvc\MvcEvent))
#1 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#2 /var/www/html/vendor/zendframework/zend-mvc/src/Application.php(311): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#3 /var/www/html/index.php(17): Zend\Mvc\Application->run()
#4 {main}

This might be Docker version related. Version in Debian is 17.03.0-ce and in RHEL 1.10.3. This same problem also exists on Mac with Docker version 1.13.1.

This is happening for any POST? That (rather new) error is the expected outcome if you exceed the PHP post_max_size setting.

yes, no matter how big or small. I’ll make more tests, I’m quite sure this is a problem with Docker image setup.

It seems to be Omeka issue after all. “Add backstop check for too-large POST” commit breaks something on POST.

If I checkout the previous commit, I can create items via POST.
In current version REST works by removing following lines:

       if ($request->isPost() && !$_POST && !$_FILES && $_SERVER['CONTENT_LENGTH'] > 0) {
            throw new Exception\RuntimeException('POST request exceeded maximum size');
        }

That is a new check, yes. Is it still true that it works on a Debian version, or was that just using an older Omeka S version? If there is a difference between the two that would indicate some strange issue. If not, it’s probably just a bug in the check as it interacts with the API.

The Debian thing was my mistake (was running older version). The POST issue exists no matter of platform.

That’s helpful, thanks.

I’ve just pushed an update that should hopefully resolve the issue. If you try it out, please post and let me know how it works for you.

Works perfectly, thanks a lot!
This is why I love to work with open source software :slight_smile:

EDIT:
also file uploads via API work

I just downloaded the latest release 10.0.0-beta4 and installed it on a Cpanel account with the CSVimport plugin, and I am still getting this error.

You’re getting this error when doing what? Something with CSV Import?

You can legitimately get this error if you actually try to send too big of an upload to the server, too.

Yes, trying to import a CSV file. The file is 4kb

Hello, Is there a resolution to this issue? I have tried to use both “CSV Import” and “Omeka 2 Import” and am getting similar errors. The csv file is not a large one and I have tried setting the number of records to import to 1 to decrease the size as well. I am running Omeka S version 1.0.0-rc.1.

[24-Oct-2017 18:07:21 UTC] exception ‘Omeka\Mvc\Exception\RuntimeException’ with message ‘POST request exceeded maximum size’ in /home/btinkerd/public_html/omeka-rc1/application/src/Mvc/MvcListeners.php:362
Stack trace:
#0 /home/btinkerd/public_html/omeka-rc1/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Omeka\Mvc\MvcListeners->checkExcessivePost(Object(Zend\Mvc\MvcEvent))
#1 /home/btinkerd/public_html/omeka-rc1/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#2 /home/btinkerd/public_html/omeka-rc1/vendor/zendframework/zend-mvc/src/Application.php(311): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#3 /home/btinkerd/public_html/omeka-rc1/index.php(21): Zend\Mvc\Application->run()
#4 {main}

What’s your maximum POST size setting?

We list it (as “POST Size Limit”) on the system information page accessible from the bottom-right of any admin page.

It’s currently set to 160M but when I first examined the .ini file it wasn’t set at all and I added it. I am running on Reclaim Hosting so there may be something with the configuration there because there were tweaks that needed to be done for 2.x to run some plugins (setting the php background path).

And just to be sure, Omeka S is also reporting the POST Size Limit as “160M” exactly on the System Information page?

Are you able to upload files normally (i.e., when creating or editing an individual item)?

Yes the system information listed by Omeka S shows the 160M number and I just uploaded a 20mb image with no trouble.

For both the CSV import and Omeka 2 Import plugins the first screen goes fine (where you select your csv file and input the api endpoint respectively) but on the second page when you click import the error pops up in the log immediately. The jobs show up in the “jobs” tab just listed as “Starting”.

Okay given what you’ve said there’s definitely something not working correctly…

Where in the process does the problem occur for each plugin?