i get this error, while known attack IPs are not blocked.
TypeError: Argument 1 passed to Drupal\Core\Routing\RequestContext::fromRequest() must be an instance of Symfony\Component\HttpFoundation\Request, null given, called in /home/public_html/core/lib/Drupal/Core/Routing/RequestContext.php on line 31 in Drupal\Core\Routing\RequestContext->fromRequest() (line 37 of /home/public_html/core/lib/Drupal/Core/Routing/RequestContext.php) #0 /home/public_html/core/lib/Drupal/Core/Routing/RequestContext.php(31): Drupal\Core\Routing\RequestContext->fromRequest(NULL) #1 [internal function]: Drupal\Core\Routing\RequestContext->fromRequestStack(Object(Symfony\Component\HttpFoundation\RequestStack)) #2 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(332): call_user_func_array(Array, Array) #3 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'router.request_...') #4 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(494): Drupal\Component\DependencyInjection\Container->get('router.request_...', 3) #5 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(329): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #6 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(509): Drupal\Component\DependencyInjection\Container->createService(Array, 'private__9ONHkk...') #7 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(236): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #8 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'url_generator') #9 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(494): Drupal\Component\DependencyInjection\Container->get('url_generator', 1) #10 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(236): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #11 /home/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'link_generator') #12 /home/public_html/core/lib/Drupal.php(158): Drupal\Component\DependencyInjection\Container->get('link_generator') #13 /home/public_html/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php(56): Drupal::service('link_generator') #14 /home/public_html/core/lib/Drupal/Core/Link.php(136): Drupal\Core\Link->getLinkGenerator() #15 /home/public_html/modules/httpbl/src/HttpblEvaluator.php(705): Drupal\Core\Link->toString() #16 /home/public_html/modules/httpbl/src/HttpblEvaluator.php(256): Drupal\httpbl\HttpblEvaluator::projectLink('157.55.39.136') #17 /home/public_html/modules/httpbl/src/HttpblMiddleware.php(69): Drupal\httpbl\HttpblEvaluator->evaluateVisitor('157.55.39.136', Object(Symfony\Component\HttpFoundation\Request)) #18 /home/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\httpbl\HttpblMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /home/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /home/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /home/public_html/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /home/public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #23 {main}.
Comments
Comment #2
alex_optimComment #3
alex_optimComment #4
bryrock commentedThanks for the report. I've seen this error occur a few times on a test site, but haven't ever seen or been able to recreate the error on development site, so still trying to debug it and figure out possible environment differences/dependencies, etc.
Comment #5
alayham commentedI have httpbl checking every request, and the perimeter module checking page not found events. I am getting this error, and known attackers are banned by Perimeter, not by this module
Comment #6
alayham commentedComment #7
bryrock commentedWhat do you mean by "known attack IPs"? Known by what means?
Comment #8
alayham commentedPerimeter blocked some IPs. I checked two of them on http://www.projecthoneypot.org/home.php and found them listed as known dictionary attackers. I suppose they should be blocked by httpbl before generating a page not found and reaching perimeter.
Comment #9
matthewn commentedI have started receiving this error on every page load since upgrading to Drupal 8.5.0.
Any IP that is not whitelisted receives "The website encountered an unexpected error. Please try again later." and watchdog shows the same error reported at the top of this issue.
Turning off Http:BL Blocking solves the problem. :(
Happy to provide more info if it might help solve this...
Comment #10
bryrock commentedStill haven't been able to nail this down to a discreet conflict, but after reading the following... #2701575: RequestContext throws error when current request is empty
... this module's conflict with page_cache appears to happen while generating a link (for the log).
As long as page_cache is on, the module will fail anytime a new IP is captured while hitting a cached page. The point of failure happens after the IP has already been looked up at Project Honeypot and evaluated locally. It's ready to be stored, but right before doing so it attempts to build a log record, and that's where things appear to go off the rails. Once an IP is stored, it can hit cached pages with no errors, even if verbose logging is enabled.
Alternatively, there are no errors when turning off page_cache and using only dynamic_page_cache.
I've only experienced this error myself very recently and found I could reproduce repeatedly (for new IPs only) with page_cache enabled (something I don't typically have enabled in development environment).
So, in the meantime the workaround is either turn off httpbl or turn off page_cache. There appears to be no conflict with httpbl and dynamic_page_cache.
Comment #11
bryrock commentedI'm closing this issue as a "duplicate." A new issue has been created to replace it.
#2992062: page_cache breaks httpBL