Problem

We get a Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.facets_summary.canonical" does not exist error when we try to import config after upgrade from Drupal 8.4.3 to 8.4.4.

We identified the links annotation of the \Drupal\facets_summary\Entity\FacetsSummary class as the source of the problem:

 *   links = {
 *     "canonical" = "/admin/config/search/facets",
 *     "add-form" = "/admin/config/search/facets/add-facet-summary",
 *     "edit-form" = "/admin/config/search/facets/facet-summary/{facets_summary}/edit",
 *     "settings-form" = "/admin/config/search/facets/facet-summary{facets_summary}/settings",
 *     "delete-form" = "/admin/config/search/facets/facet-summary/{facets_summary}/delete",
 *   }

There is no `facets_summary.canonical` path in the router.
And a canonical link should point to "/admin/config/search/facets/facet-summary/{facets_summary}" as in the \Drupal\node\Entity entity:

 *   links = {
 *     "canonical" = "/node/{node}",
 *     "delete-form" = "/node/{node}/delete",
 *     "edit-form" = "/node/{node}/edit",
 *     "version-history" = "/node/{node}/revisions",
 *     "revision" = "/node/{node}/revisions/{node_revision}/view",
 *     "create" = "/node",

Proposed resolution

There are 2 options to fix the issue:

1. Remove the canonical link from the links.
2. Change the canonical link to a collection link.

Remaining tasks

Create patch (or update code) to remove or change the canonical link.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zero2one created an issue. See original summary.

zero2one’s picture

Issue summary: View changes
zero2one’s picture

Issue summary: View changes
borisson_’s picture

I'm not sure if just removing the link will lead to other issues, but if we can, we should totally do that.

zero2one’s picture

This is the patch to remove the wrong link from the FacetSummary entity.

mpp’s picture

Have a look at the API documentation here: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

Optionally, instead of defining routes, routes can be auto generated by providing a route handler. See Entity routes. Otherwise, define routes and links for the various URLs associated with the entity. These go into the 'links' annotation, with the link type as the key, and the path of this link template as the value. The corresponding route requires the following route name: "entity.$entity_type_id.$link_template_type". See Entity routes below for some routing notes. Typical link types are:

  • canonical: Default link, either to view (if entities are viewed on their own pages) or edit the entity.
  • delete-form: Confirmation form to delete the entity.
  • edit-form: Editing form.
  • Other link types specific to your entity type can also be defined.

The link was to the overview, I've seen references to "collection" in other contrib modules like pathauto.

borisson_’s picture

Status: Active » Needs review

Let's see how the testbot feels about that.

borisson_’s picture

Status: Needs review » Fixed

Committed and pushed, thanks so much for helping here.

  • borisson_ committed 77734ea on 8.x-1.x authored by zero2one
    Issue #2936781 by zero2one: Config import broken due to wrong usage of "...
idebr’s picture

Issue summary: View changes

Adding the exact error message for search engines:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.facets_summary.canonical" does not exist

Status: Fixed » Closed (fixed)

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

zlatev’s picture

Hi,

I'm upgrading from 8.2.x to 8.4.x and the only way to bypass the error above was to change canonical into collection as the patch above didn't worked out.