WSOD when installing Experience Builder/dev mode when installing in combination with Search API Pages

Created on 13 March 2025, about 1 month ago

Overview
Good Morning, I tried to install Experiencie builder in a Drupal 11.1.4 instance (DDEV/PHP 8.3), but I also have the Search API builder installed, and I got these messages after attempting to install the modules:

The website encountered an unexpected error. Try again later.

AssertionError: Cannot load the "search_api_page" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->load() (Line: 116)
Drupal\search_api_page\Plugin\Block\SearchApiPageBlock->calculateDependencies() (Line: 133)
Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\BlockComponent->calculateDependencies() (Line: 71)
Drupal\Core\Config\Entity\ConfigEntityBase->getPluginDependencies() (Line: 89)
Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies() (Line: 388)
Drupal\Core\Config\Entity\ConfigEntityBase->calculateDependencies() (Line: 328)
Drupal\Core\Config\Entity\ConfigEntityBase->preSave() (Line: 528)
Drupal\Core\Entity\EntityStorageBase->doPreSave() (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save() (Line: 239)
Drupal\Core\Config\Entity\ConfigEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 617)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 140)
Drupal\experience_builder\Entity\Component->save() (Line: 105)
Drupal\experience_builder\Plugin\BlockManager->setCachedDefinitions() (Line: 214)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 190)
experience_builder_modules_installed()
call_user_func_array() (Line: 355)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 307)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 354)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 725)
Drupal\Core\Extension\ModuleInstaller->invokeAll() (Line: 392)
Drupal\Core\Extension\ModuleInstaller->install() (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() (Line: 504)
Drupal\system\Form\ModulesListForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
another warning:

Warning: Undefined array key "search_api_page" in Drupal\search_api_page\Plugin\Block\SearchApiPageBlock->calculateDependencies() (line 116 of modules/contrib/search_api_page/src/Plugin/Block/SearchApiPageBlock.php).

Proposed resolution
The problem lies in this piece of code:

/**
* {@inheritdoc}
*/
public function calculateDependencies() {
$search_api_page = $this->searchApiPageStorage->load($this->configuration['search_api_page']);
if ($search_api_page === NULL) {
return [];
}
return ['config' => [$search_api_page->getConfigDependencyName()]];
}
Perhaps we should check if that key exists and is not empty before loading the API Storage? Something basic like:

/**
* {@inheritdoc}
*/
public function calculateDependencies() {
if (isset($this->configuration['search_api_page']) && !empty($this->configuration['search_api_page'])) {
$search_api_page = $this->searchApiPageStorage->load($this->configuration['search_api_page']);
if ($search_api_page === NULL) {
return [];
}
}
else {
return [];
}

return ['config' => [$search_api_page->getConfigDependencyName()]];
}
I haven't created a Search API page yet, maybe it's that.

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇨🇦Canada danrod Ottawa

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024