API requests changed from PUT to POST after upgrade from 3.2.1.2 to 3.3.0.5

Earlier today I upgraded from 3.2.1.2 to 3.3.0.5. Since then all the asynchronous requests in the admin area that were previous PUT requests are now sending as POST requests.

This is causing all the requests to fail with a 403 and the following body:

{"error":"api.404.endpointNotFound","errorMessage":"The requested URL was not recognized."}

After some debugging I’ve determined that this is being returned here: pkp-lib/ApiAuthorizationMiddleware.inc.php at main · pkp/pkp-lib · GitHub

That means that it is not able to find ‘route’ in the request. It looks like this is because it is not being set here Slim/App.php at 3.x · slimphp/Slim · GitHub - and this is because $routeInfo[0] is 2 - which is the value of the METHOD_NOT_ALLOWED in Dispatcher.

So that explains why I’m getting the response I’m getting, but it doesn’t really explain why the initial request would be sending as POST instead of PUT following the upgrade. Any thoughts? Is this a bug or have I botched the upgrade somehow?

Hi @daniel815,

Our continuous integration testing exercises the setup/admin areas and they are working fine (also on my machine), so I suspect something is different about your environment. Is there a particular request that you are running into trouble with that we could use as an example to troubleshoot?

Regards,
Alec Smecher
Public Knowledge Project Team

It is all asynchronous requests, but let’s use the “Journal Settings” as an example. I’ve also noticed that some textareas are completely missing. See below:

Screenshot 2021-04-09 at 09.47.14

I’ve downloaded the latest version again this morning from https://pkp.sfu.ca/ojs/ojs_download/, extracted it, copied over config.inc.php, public and .htaccess (my storage location is somewhere else). Again, the issue persists. I ran the database update script when I first upgraded yesterday.

Some PHP errors that might help:

[09-Apr-2021 12:49:05 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/classes/context/Context.inc.php on line 292
[09-Apr-2021 12:49:05 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/pages/management/ManagementHandler.inc.php on line 104
[09-Apr-2021 12:49:06 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/classes/context/Context.inc.php on line 292
[09-Apr-2021 12:49:06 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/classes/context/Context.inc.php on line 292
[09-Apr-2021 12:49:07 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/classes/context/Context.inc.php on line 225
[09-Apr-2021 12:49:16 UTC] PHP Notice:  Undefined index: b:0; in /app/public/lib/pkp/classes/context/Context.inc.php on line 292

Hi @daniel815,

The settings pages were all rewritten some time ago, which IIRC introduced the shift you’re seeing from POST to PUT. The rich text editors being missing leads me to suspect that your browser is caching some old Javascript, which could explain the other problems as well. Please try a hard cache flush on your browser to see if that changes behaviour.

Regards,
Alec Smecher
Public Knowledge Project Team