Getting error on enabling webform module with next module already enabled

Created on 28 March 2024, 9 months ago
Updated 5 April 2024, 9 months ago

Getting below error on enabling Webform module

The website encountered an unexpected error. Please try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.webform.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('entity.webform.canonical') (Line: 276)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.webform.canonical', Array, Array, 1) (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.webform.canonical', Array, Array, 1) (Line: 765)
Drupal\Core\Url->toString(1) (Line: 78)
Drupal\next\Event\EntityActionEvent::createFromEntity(Object, 'insert') (Line: 71)
next_entity_insert(Object, 'webform')
call_user_func_array(Object, Array) (Line: 409)

Cause of issue is

/**
 * Implements hook_entity_insert().
 */
function next_entity_insert(EntityInterface $entity) {
  $event = EntityActionEvent::createFromEntity($entity, EntityActionEventInterface::INSERT_ACTION);
  drupal_register_shutdown_function('_next_dispatch_entity_action_event', $event);
}

If I clear route cache before this then everything works fine.

/**
 * Implements hook_entity_insert().
 */
function next_entity_insert(EntityInterface $entity) {
// Clear route cache
  \Drupal::service("router.builder")->rebuild();
  $event = EntityActionEvent::createFromEntity($entity, EntityActionEventInterface::INSERT_ACTION);
  drupal_register_shutdown_function('_next_dispatch_entity_action_event', $event);
}
🐛 Bug report
Status

Active

Version

1.6

Component

Code

Created by

🇮🇳India vikas shishodia

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

Comments & Activities

Production build 0.71.5 2024