Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException on some paths caused by module

Created on 4 May 2023, about 1 year ago
Updated 15 February 2024, 5 months ago

Problem/Motivation

There is possiblity that domain_entity outbound path processor may case the error:


Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: No route found for the specified format html. Supported formats: hal_json, schema_json:json, json, xml, schema_json. in Drupal\Core\Routing\RequestFormatRouteFilter->filter() (line 65 of /var/www/html/web/core/lib/Drupal/Core/Routing/RequestFormatRouteFilter.php).


#0 /var/www/html/web/core/lib/Drupal/Core/Routing/Router.php(280): Drupal\Core\Routing\RequestFormatRouteFilter->filter()
#1 /var/www/html/web/core/lib/Drupal/Core/Routing/Router.php(126): Drupal\Core\Routing\Router->applyRouteFilters()
#2 /var/www/html/web/core/lib/Drupal/Core/Routing/Router.php(103): Drupal\Core\Routing\Router->matchRequest()
#3 /var/www/html/web/core/lib/Drupal/Core/Path/PathValidator.php(161): Drupal\Core\Routing\Router->match()
#4 /var/www/html/web/core/lib/Drupal/Core/Path/PathValidator.php(122): Drupal\Core\Path\PathValidator->getPathAttributes()
#5 /var/www/html/web/core/lib/Drupal/Core/Path/PathValidator.php(89): Drupal\Core\Path\PathValidator->getUrl()
#6 /var/www/html/web/core/lib/Drupal/Core/Url.php(427): Drupal\Core\Path\PathValidator->getUrlIfValidWithoutAccessCheck()
#7 /var/www/html/web/core/lib/Drupal/Core/Url.php(319): Drupal\Core\Url::fromInternalUri()
#8 /var/www/html/web/core/lib/Drupal/Core/Url.php(221): Drupal\Core\Url::fromUri()
#9 /var/www/html/web/modules/contrib/domain_entity/src/HttpKernel/DomainEntitySourcePathProcessor.php(147): Drupal\Core\Url::fromUserInput()
#10 /var/www/html/web/core/lib/Drupal/Core/PathProcessor/PathProcessorManager.php(108): Drupal\domain_entity\HttpKernel\DomainEntitySourcePathProcessor->processOutbound()
#11 /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(394): Drupal\Core\PathProcessor\PathProcessorManager->processOutbound()
#12 /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(296): Drupal\Core\Routing\UrlGenerator->processPath()
#13 /var/www/html/web/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(105): Drupal\Core\Routing\UrlGenerator->generateFromRoute()
#14 /var/www/html/web/modules/contrib/redirect/src/EventSubscriber/RouteNormalizerRequestSubscriber.php(105): Drupal\Core\Render\MetadataB...

The error appears at path generated by rest module. I have special resource (path: taxonomy/{vocabulary}/{parent}) that returns subtree of taxonomy. After recent updates to Drupal core and domain_entity, the error started to popup.

Proposed resolution

Apply the attached patch to fix the issue. The patch should ensure that the system properly handles unsupported formats and avoids returning error.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland jsobiecki Wroclaw

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024