core icon indicating copy to clipboard operation
core copied to clipboard

ErrorNormalizer instantiate always with debug=false

Open Zempheroth opened this issue 1 year ago • 0 comments

API Platform version(s) affected: 3.3.11 | 3.4

Description
after update to 3.3.11(also tested in 3.4 today) debug info (trace) missed in response even for env=dev with APP_DEBUG=1 for non jsonApi , api_platform.yaml config like:

error_formats:
      json:
          mime_types: ['application/json']
      jsonld:
          mime_types: ['application/ld+json']

during instantiation service api_platform.hydra.normalizer.error %kernel.debug% value for $debug param is always false How to reproduce
throw any exception in BE code (in controller for example), use request header Accept: application/ld+json for content negotiation and invocation of HydraErrorNormalizer during serialize an Exception

Possible Solution
Usage Decoration for @api_platform.hydra.normalizer.error like workaround below helps, but it's not a solution:

    App\Decorator\ErrorNormalizer:
        arguments:
            $urlGenerator: '@api_platform.router'
            $debug: '%kernel.debug%'
            $decoratedHydraErrorNormalizer: '@api_platform.hydra.normalizer.error'

Additional Context

Zempheroth avatar Sep 20 '24 22:09 Zempheroth