fix: #3622105 Install canvas_page_template_component from the recipe so RecipeAppliedEvent does not rebuild the container

Issue: #3622105 Installing the Varbase Starter site template with drush site:install on plain Drupal CMS fails with "You have requested a synthetic service (kernel)"

Problem

On a plain drupal/cms codebase (Drupal core 11.4.6, drupal/canvas 1.11.0, no patches), drush site:install recipes/varbase_starter exits 1 with a RuntimeException: You have requested a synthetic service (kernel), thrown while RecipeAppliedEvent is being dispatched.

Root cause

Drupal\canvas\EventSubscriber\RecipeSubscriber reaches PageVariantMigration::createFromPageRegions(), which installs canvas_page_template_component when a theme with page regions has no page variant yet. Installing a module during the event rebuilds the service container underneath listeners that have not run, and drupal_cms_helper's own RecipeSubscriber then resolves a hook class through a ClassResolver still holding the pre-rebuild container.

Varbase Starter always meets the trigger condition because it ships canvas.page_region.vartheme_bs5.header and .footer.

The change

One line in recipe.yml: canvas_page_template_component added to the recipe's own install list, with a comment and @see pointers to the two upstream classes. The module then already exists when the event fires, so nothing is installed mid-dispatch.

Same defect and same remedy as the sibling Horizon Aid fix: #3622092 / horizonaid!83 (merged).

Verification (run locally today, plain drupal/cms, core 11.4.6, canvas 1.11.0, no patches, nothing pinned)

  • drush site:install recipes/varbase_starter exits 0, 0 warnings, 0 errors.
  • drush site:install drupal_cms_installer installer_site_template_form.add_ons=varbase_starter exits 0, 0 warnings, 0 errors.
  • HTTP 200 on /, /features, /blog, /about-varbase, /contact-us, /user/login, /search?keywords=varbase.
  • Content and config present: 14 nodes, 5 Canvas pages, 59 media items, default theme vartheme_bs5.
  • No PHP errors in watchdog.

Note for reviewers

The underlying defect is upstream in drupal/canvas: a module installed during RecipeAppliedEvent strands earlier-resolved listeners on a stale container. This change only stops Varbase Starter triggering it. Related: drupal_cms#3591450 (closed).

AI policy disclosure

AI-Generated: Yes

Assisted by Claude Code (Claude Opus 5), per the Policy on the use of AI when contributing to Drupal.

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release
Edited by Rajab Natshah

Merge request reports

Loading
Loading