- Issue created by @Joris Handstanger
The GoogleApiServiceClient entity has a canonical route defined in its annotation, but this route is not defined in the routing file. This can cause the exception "Route "entity.google_api_service_client.canonical" does not exist".
For us this happened after some recent core updates, blocking config import.
I've found an old issue for this: https://www.drupal.org/project/google_api_client/issues/3449473 🐛 GoogleApiServiceClient canonical route Fixed , but this fix was only applied to the 3.x branch, the latest versions still have this issue.
Steps described in https://www.drupal.org/project/google_api_client/issues/3449473 🐛 GoogleApiServiceClient canonical route Fixed :
- 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
Apply the fix in https://www.drupal.org/project/google_api_client/issues/3449473 🐛 GoogleApiServiceClient canonical route Fixed to the 4.x branch as well, this removes the canonical route from the annotation.
Alternatively, if the canonical route for this entity type is desired, it should be defined in the routing file.
Active
4.5
Code