Uncaught exception 'TypeError' with message 'Drupal\layout_builder_iframe_modal\IframeModalHelper::isModalRoute(): Argument #1 ($route_name) must be of type string, null given.

Created on 16 February 2023, over 1 year ago
Updated 8 April 2024, 7 months ago

Problem/Motivation

I started getting the following error sporadically on my site:

Uncaught exception 'TypeError' with message 'Drupal\layout_builder_iframe_modal\IframeModalHelper::isModalRoute(): Argument #1 ($route_name) must be of type string, null given, called in /mnt/www/html/mysite/docroot/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.module  on line 33' in /mnt/www/html/mysite/docroot/modules/contrib/layout_builder_iframe_modal/src/IframeModalHelper.php:42

 in Drupal\layout_builder_iframe_modal\IframeModalHelper::isModalRoute called at /mnt/www/html/mysite/docroot/modules/contrib/layout_builder_iframe_modal/layout_builder_iframe_modal.module (33)
 in layout_builder_iframe_modal_preprocess_html called at ? (?)
 in call_user_func_array called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php (287)
 in Drupal\Core\Theme\ThemeManager::render called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php (422)
 in Drupal\Core\Render\Renderer::doRender called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php (201)
 in Drupal\Core\Render\Renderer::render called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php (145)
 in Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure} called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php (564)
 in Drupal\Core\Render\Renderer::executeInRenderContext called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/Renderer.php (146)
 in Drupal\Core\Render\Renderer::renderRoot called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php (66)
 in Drupal\Core\Render\BareHtmlPageRenderer::renderBarePage called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/ProxyClass/Render/BareHtmlPageRenderer.php (76)
 in Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer::renderBarePage called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php (160)
 in Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest called at ? (?)
 in call_user_func called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php (142)
 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php (127)
 in Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance called at ? (?)
 in call_user_func called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php (142)
 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch called at /mnt/www/html/mysite/vendor/symfony/http-kernel/HttpKernel.php (229)
 in Symfony\Component\HttpKernel\HttpKernel::handleThrowable called at /mnt/www/html/mysite/vendor/symfony/http-kernel/HttpKernel.php (92)
 in Symfony\Component\HttpKernel\HttpKernel::handle called at /mnt/www/html/mysite/docroot/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php (67)
 in Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap::handle called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php (58)
 in Drupal\Core\StackMiddleware\Session::handle called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php (48)
 in Drupal\Core\StackMiddleware\KernelPreHandle::handle called at /mnt/www/html/mysite/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php (49)
 in Asm89\Stack\Cors::handle called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php (48)
 in Drupal\Core\StackMiddleware\ReverseProxyMiddleware::handle called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php (51)
 in Drupal\Core\StackMiddleware\NegotiationMiddleware::handle called at /mnt/www/html/mysite/vendor/stack/builder/src/Stack/StackedHttpKernel.php (23)
 in Stack\StackedHttpKernel::handle called at /mnt/www/html/mysite/docroot/core/lib/Drupal/Core/DrupalKernel.php (709)
 in Drupal\Core\DrupalKernel::handle called at /mnt/www/html/mysite/docroot/index.php (19) 

Steps to reproduce

I am still unsure what is causing the error to trigger, but it needs to be addressed.

Proposed resolution

Add a condition before isModalRoute is called to ensure the $route_name is not null

πŸ› Bug report
Status

RTBC

Version

1.2

Component

Code

Created by

πŸ‡²πŸ‡½Mexico GafgarionMorua Puerto Vallarta

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

Comments & Activities

Production build 0.71.5 2024