silverstripe / silverstripe-restfulserver

RestfulServer module for Silverstripe CMS
http://www.silverstripe.org/restfulserver-module/
BSD 3-Clause "New" or "Revised" License
45 stars 48 forks source link

/api/v1/ gives "action notFound was not found" error #78

Open sanderha opened 5 years ago

sanderha commented 5 years ago

Accessing the root /api/v1gives this error in dev mode:

Action 'notFound' isn't available on class SilverStripe\RestfulServer\RestfulServer.

Havent looked into the issue yet.

Using recipe-cms ^4.3, php 7.3 and ^2.1 of this module

robbieaverill commented 5 years ago

Hi @sanderha, I can't reproduce this issue. I'm using recipe-cms 4.4.1, php 7.1 and 2.1.2.

You can see that RestfulServer.allowed_actions defines notFound as an allowed action:

    private static $allowed_actions = array(
        'index',
        'notFound'
    );

Admittedly, I'm not getting the "That object wasn't found" response from /api/v1, but I am getting a 404 page.

Test steps:

Are you able to provide more information to help?

sanderha commented 5 years ago

Hmm I can see that my CMS has not generated the 404 page for some reason.. Maybe thats why I'm seting the Action 'notFound' isn't available message, because the response is a 404 correctly. And you probably did have the 404 error page in the CMS, so thats why you got that displayed when vising /api/v1.

I will try to debug some more to see whats wrong

robbieaverill commented 5 years ago

Yeah that could be it. The core indicates that it expects to handle its own 404 response, so perhaps the bug is that it’s not doing so