GoogleApiServiceClient canonical route

Created on 23 May 2024, about 1 month ago

Problem/Motivation

The GoogleApiServiceClient class defines a canonical link template but does not actually implement the route. So, if a module attempts to render the canonical route, they will get a "Route "entity.google_api_service_client.canonical" does not exist" exception.

More specifically: a site I'm working on has the Next module β†’ installed. There is a hook that runs when an entity is created/updated/deleted that attempts get the canonical URL (here). This issue prevents google_api_service_client entities from being deleted when used with the Next module.

Steps to reproduce

- Create at least one google_api_service_client entity
- Run the following with Drush:

( drush eval "$(cat)" ) <<-'PHP_CODE'
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage('google_api_service_client');
$services = $storage->getQuery()->accessCheck(FALSE)->range(0, 1)->execute();
/** @var \Drupal\google_api_client\GoogleApiServiceClientInterface $client */
$client = $storage->load(array_key_first($services));
try {
  $client->toUrl()->toString(TRUE)->getGeneratedUrl();
}
catch (\Exception $e) {
  print 'Exception caught: ' . $e->getMessage() . PHP_EOL;
}
PHP_CODE

Proposed resolution

Remove the canonical link template

πŸ› Bug report
Status

Active

Version

4.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States steyep

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

Comments & Activities

Production build 0.69.0 2024