Error: Call to undefined method Symfony\Component\HttpFoundation\RequestStack::getMainRequest() in Drupal\facets\Plugin\facets\facet_source\SearchApiDisplay::create()

Created on 24 January 2022, almost 3 years ago
Updated 10 April 2024, 8 months ago

Problem/Motivation

In the module which I'm working on, I call $block_view = (string) $this->renderer->renderPlain($block_view);, more at https://github.com/digitalutsc/advanced_search/blob/contrib/src/Controll...

I'm getting the error which traced back to SearchAPIDisplay.php in Facets module:

Error: Call to undefined method Symfony\Component\HttpFoundation\RequestStack::getMainRequest() in Drupal\facets\Plugin\facets\facet_source\SearchApiDisplay::create() (line 120 of /var/www/drupal/web/modules/contrib/facets/src/Plugin/facets/facet_source/SearchApiDisplay.php)
#0 /var/www/drupal/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\facets\Plugin\facets\facet_source\SearchApiDisplay::create()
#1 /var/www/drupal/web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()
#2 /var/www/drupal/web/modules/contrib/facets/src/Entity/Facet.php(731): Drupal\Component\Plugin\PluginManagerBase->createInstance()
#3 /var/www/drupal/web/modules/contrib/facets/src/Plugin/Block/FacetBlock.php(78): Drupal\facets\Entity\Facet->getFacetSource()
#4 /var/www/drupal/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\facets\Plugin\Block\FacetBlock->build()
#5 [internal function]: Drupal\block\BlockViewBuilder::preRender()
#6 /var/www/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#7 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(772): Drupal\Core\Render\Renderer->doTrustedCallback()
#8 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(363): Drupal\Core\Render\Renderer->doCallback()
#9 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender()
#10 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(157): Drupal\Core\Render\Renderer->render()
#11 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#12 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(158): Drupal\Core\Render\Renderer->executeInRenderContext()
#13 /var/www/drupal/web/modules/contrib/advanced_search/src/Controller/AjaxBlocksController.php(158): Drupal\Core\Render\Renderer->renderPlain()
#14 [internal function]: Drupal\advanced_search\Controller\AjaxBlocksController->respond()
#15 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#16 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#18 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#19 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#21 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#22 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#23 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#24 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#25 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#26 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#27 /var/www/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#28 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#29 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#30 {main}

I have the Facets module installed with 2.0.1 version. I'm wondering if anyone can help me to solve the issue ? Thank you very much

πŸ’¬ Support request
Status

Postponed: needs info

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada kylehuynh

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

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Status changed to Postponed: needs info 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Wonder if this has been fixed since 2.0.1?

Production build 0.71.5 2024