You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm trying to enable rfc_7807_compliant_errors as an upgrade path to v4. When I do this, in my project, not only the error output changes (obviously), but I also get:
ApiPlatform\Metadata\Exception\InvalidArgumentException: Unable to generate an IRI for the item of type ....
fetching an Organisation for a given user, and the user has access to the Organisation, it returns the Organisation
fetching an Organisation for a given user, and the user does not have access to an Organisation, it returns HTTP 404.
The following happens:
With rfc_7807_compliant_errors to false, both test cases succeed.
With rfc_7807_compliant_errors to true, the second test case throws: ApiPlatform\Metadata\Exception\InvalidArgumentException: Unable to generate an IRI for the item of type "App\Organisation". When I then remove the line 'item_uri_template' => '/organisations/{id}', from the operation, the test succeeds again.
Hi @darthf1 API Platform was not able to gather identifiers from Organization, can you maybe api-resource:debug the first operation and check if it has uriVariables? I have no explanation for why the flag has this impact, what I usually do to debug exceptions is to dump directly inside the ErrorListener, my guess is that an exception is thrown no matter the rfc_7807_compliant_errors flag.
When I set rfc_7807_compliant_errors to false, and i press "Step Over", I go to the next line and a few clicks later it responds with a 404.
When I set rfc_7807_compliant_errors to true, and i press "Step Over", I somehow end up again in the ReadProvider, but this time $data is not null but an Error resource.
API Platform version(s) affected: 3.4.3
Description
I'm trying to enable
rfc_7807_compliant_errors
as an upgrade path to v4. When I do this, in my project, not only the error output changes (obviously), but I also get:How to reproduce
I have the following code:
I have two test cases:
The following happens:
rfc_7807_compliant_errors
tofalse
, both test cases succeed.rfc_7807_compliant_errors
totrue
, the second test case throws:ApiPlatform\Metadata\Exception\InvalidArgumentException: Unable to generate an IRI for the item of type "App\Organisation"
. When I then remove the line'item_uri_template' => '/organisations/{id}',
from the operation, the test succeeds again.Additional Context
My (partial) config:
Full stacktrace:
The text was updated successfully, but these errors were encountered: