Skip to content

404/422 Errors triggers exceptions Parameter "status" not found, check the identifiers configuration #6002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jderusse opened this issue Nov 28, 2023 · 4 comments

Comments

@jderusse
Copy link
Contributor

API Platform version(s) affected: 3.2.6

Description

Since v3.2.6 404 errors trigger a new exception (reported by sentry)

Parameter "status" not found, check the identifiers configuration.

This is triggered by the UriVariablesResolverTrait trait when resolving the "/errors/{status}" template.

The status parameter does not exist.

There is a variant with 422 trying to resolve the /validation_errors/{id} template from the ApiPlatform\Symfony\Validator\Exception\ValidationException resource

How to reproduce

Call a /resources/id_does_not_exist endpoint, watch Symfony's profiler logs panel

Possible Solution

Additional Context

maybe related to #5974

@soyuka
Copy link
Member

soyuka commented Nov 28, 2023

I have trouble reproducing this, can you give me the stack trace behind the parameter issue?

@jderusse
Copy link
Contributor Author

I have trouble reproducing this, can you give me the stack trace behind the parameter issue?

Thank for taking time on this issue.

the stack trace is


#0 /srv/api/vendor/api-platform/core/src/Symfony/Controller/MainController.php(84): ApiPlatform\Symfony\Controller\MainController->getOperationUriVariables()
#1 /srv/api/vendor/symfony/http-kernel/HttpKernel.php(181): ApiPlatform\Symfony\Controller\MainController->__invoke()
#2 /srv/api/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#3 /srv/api/vendor/symfony/http-kernel/EventListener/ErrorListener.php(108): Symfony\Component\HttpKernel\HttpKernel->handle()
#4 /srv/api/vendor/api-platform/core/src/Symfony/EventListener/ExceptionListener.php(48): Symfony\Component\HttpKernel\EventListener\ErrorListener->onKernelException()
#5 /srv/api/vendor/symfony/event-dispatcher/Debug/WrappedListener.php(116): ApiPlatform\Symfony\EventListener\ExceptionListener->onKernelException()
#6 /srv/api/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
#7 /srv/api/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#8 /srv/api/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(139): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#9 /srv/api/vendor/symfony/http-kernel/HttpKernel.php(239): Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
#10 /srv/api/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
#11 /srv/api/vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle()
#12 /srv/api/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\Component\HttpKernel\Kernel->handle()
#13 /srv/api/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
#14 /srv/api/public/index.php(6): require_once('/srv/api/vendor...')

the reproducer using the official APIP demo:

$ git clone https://github.com/api-platform/demo.git
$ cd demo/api
$ composer up 
$ cd ..
$ docker compose up --wait

$ curl -k https://localhost/books/123.jsonld
$ open https://localhost/_profiler/latest?panel=logger

The log pannel contains 3 errors (2 expected for the NotFoundException) on for the status parameter
image

@soyuka
Copy link
Member

soyuka commented Nov 29, 2023

Okay this was only some logging with no influence on behavior but I skipped this particular case, it'll be released by the end of the week. Thanks!

@soyuka soyuka closed this as completed Nov 29, 2023
@jderusse
Copy link
Contributor Author

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants