Fatal error when Request not ready

Created on 26 May 2020, over 4 years ago
Updated 26 August 2024, 3 months ago

I can't enable Domain Configuration submodule.
Here's the log.
What am I missing ?

TypeError: Argument 1 passed to Drupal\Core\Routing\CurrentRouteMatch::getRouteMatch() must be an instance of Symfony\Component\HttpFoundation\Request, null given, called in /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php on line 87 in Drupal\Core\Routing\CurrentRouteMatch->getRouteMatch() (line 99 of /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php)
#0 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php(87): Drupal\Core\Routing\CurrentRouteMatch->getRouteMatch(NULL)
#1 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php(49): Drupal\Core\Routing\CurrentRouteMatch->getCurrentRouteMatch()
#2 /home/user/public_html/drupal89dev/docroot/modules/contrib/conflict/conflict.module(67): Drupal\Core\Routing\CurrentRouteMatch->getRouteObject()
#3 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(366): conflict_entity_load(Array, 'domain')
#4 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(307): Drupal\Core\Entity\EntityStorageBase->postLoad(Array)
#5 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(578): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#6 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain/src/DomainStorage.php(107): Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array)
#7 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain/src/DomainNegotiator.php(100): Drupal\domain\DomainStorage->loadByHostname('drupal89...')
#8 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain/src/DomainNegotiator.php(144): Drupal\domain\DomainNegotiator->setRequestDomain('drupal89...')
#9 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain/src/DomainNegotiator.php(153): Drupal\domain\DomainNegotiator->negotiateActiveDomain()
#10 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain_config/src/DomainConfigOverrider.php(213): Drupal\domain\DomainNegotiator->getActiveDomain(true)
#11 /home/user/public_html/drupal89dev/docroot/modules/contrib/domain/domain_config/src/DomainConfigOverrider.php(97): Drupal\domain_config\DomainConfigOverrider->initiateContext()
#12 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(209): Drupal\domain_config\DomainConfigOverrider->loadOverrides(Array)
#13 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(169): Drupal\Core\Config\ConfigFactory->loadOverrides(Array)
#14 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(104): Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, true)
#15 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(89): Drupal\Core\Config\ConfigFactory->doGet('shield.settings')
#16 /home/user/public_html/drupal89dev/docroot/modules/contrib/shield/src/ShieldMiddleware.php(48): Drupal\Core\Config\ConfigFactory->get('shield.settings')
#17 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\shield\ShieldMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /home/user/public_html/drupal89dev/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /home/user/public_html/drupal89dev/docroot/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /home/user/public_html/drupal89dev/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#22 {main}
🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update about 1 year ago
    1 pass
  • 🇺🇦Ukraine vaza18

    As it was mentioned above, the issue occurs, when some modules that implemented Middleware, such as Shield or Cloudflare, load entities (such as Key module, which stores credentials securely). At that time the request object may not be ready yet depending on various conditions.

    I would suggest the following alternative patch, which in addition to the request validation also checks if entity is actually a content entity.

  • 🇷🇸Serbia levmyshkin Novi Sad, Serbia

    Patch #5 is working for me. I could install Domain modules, but when I tried to add a new Domain, it failed with the error. #5 patched help to fix this problem.

  • Status changed to RTBC 3 months ago
  • 🇷🇸Serbia levmyshkin Novi Sad, Serbia
  • 🇨🇦Canada joseph.olstad

    Has anyone tested this patch with sites not using the domain approach?

    Also, can someone please roll this patch into a branch and make a merge request?

  • 🇨🇦Canada joseph.olstad
    git remote add conflict-3142921 git@git.drupal.org:issue/conflict-3142921.git
    git fetch conflict-3142921

    git checkout -b '3142921-fatal-error-when' --track conflict-3142921/'3142921-fatal-error-when'

    git push --set-upstream conflict-3142921 HEAD

  • First commit to issue fork.
  • Merge request !13Issue#3142921:fatal-error. → (Open) created by Unnamed author
  • Pipeline finished with Success
    2 months ago
    Total: 339s
    #291940
Production build 0.71.5 2024