Some entities have canonical link template but they don't implement a canonical route (eg. JSONAPI resource), redirect module causes an exception when the entity gets deleted.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route        [error]
"entity.jsonapi_resource_config.canonical" does not exist. in
/app/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php:202
Stack trace:
#0 /app/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php(421):
Drupal\Core\Routing\RouteProvider->getRouteByName('entity.jsonapi_...')
#1 /app/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php(130):
Drupal\Core\Routing\UrlGenerator->getRoute('entity.jsonapi_...')
#2
/app/docroot/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(68):
Drupal\Core\Routing\UrlGenerator->getPathFromRoute('entity.jsonapi_...',
Array)
#3 /app/docroot/core/lib/Drupal/Core/Url.php(790):
Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute('entity.jsonapi_...',
Array)
#4 /app/docroot/modules/contrib/redirect/redirect.module(83):
Drupal\Core\Url->getInternalPath()
#5 [internal function]:
redirect_entity_delete(Object(Drupal\jsonapi_extras\Entity\JsonapiResourceConfig),
'jsonapi_resourc...')
#6
/app/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(402):
call_user_func_array('redirect_entity...', Array)
#7
/app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(378):
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_delete',
Array)

redirect_delete_by_path() should be wrapped in a try..catch block so that it doesn't break the system.

Comments

sonnykt created an issue. See original summary.

sonnykt’s picture

Version: 8.x-1.x-dev » 8.x-1.2
Status: Active » Fixed

I've just checked the latest version. This issue was fixed in 8.x-1.2.

berdir’s picture

Yes, we fixed it, but for the record:

> Some entities have canonical link template but they don't implement a canonical route (eg. JSONAPI resource)

That is a bug in those modules. Other things will fail on that as well.

So you should report it there as well. Usually that's just copy paste mistakes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.