Problem/Motivation
I see lot of errors in the logs:
Url showing like this:
/search?5B2%5D=con%5D%3Dcontent_type%3Asubmit_indie_music&f%5B0%5D=content_type%3Aarchive_descriptions&f%5B1%5D=content_type%3Aarticle&f%5B2%5D=content_type%3Abecome_a_talk_radio_guest&f%5B3%5D=content_type%3Amusic_playing_on_bbs_raadio&f%5B4%5D=content_type%3Ashow_feedback&f%5B5%5D=content_type%3Aupcoming_show_topicsfacet-iisfacet-acs&page=31
Its generating errors mile this:
Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: node in /public_html/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:150
Stack trace:
#0 /public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(91): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping()
#1 /public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(64): Drupal\block_visibility_groups\GroupEvaluator->applyContexts()
#2 /public_html/web/modules/contrib/block_visibility_groups/src/Plugin/Condition/ConditionGroup.php(69): Drupal\block_visibility_groups\GroupEvaluator->evaluateGroup()
#3 /public_html/web/core/lib/Drupal/Core/Condition/ConditionManager.php(76): Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup->evaluate()
#4 /public_html/web/core/lib/Drupal/Core/Condition/ConditionPluginBase.php(85): Drupal\Core\Condition\ConditionManager->execute()
#5 /public_html/web/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php(26): Drupal\Core\Condition\ConditionPluginBase->execute()
#6 /public_html/web/core/modules/block/src/BlockAccessControlHandler.php(116): Drupal\block\BlockAccessControlHandler->resolveConditions()
#7 /public_html/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(109): Drupal\block\BlockAccessControlHandler->checkAccess()
#8 /public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php(329): Drupal\Core\Entity\EntityAccessControlHandler->access()
#9 /public_html/web/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access()
#10 /public_html/web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(138): Drupal\block\BlockRepository->getVisibleBlocksPerRegion()
#11 /public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(270): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build()
#12 /public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#13 /public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#14 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#15 /public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#16 /public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#17 /public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#18 /public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#19 /public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#20 /public_html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#21 /public_html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#22 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#23 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#24 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#25 /public_html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#26 /public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#27 /public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#28 /public_html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#29 /public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#30 /public_html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#31 /public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#32 @main
Steps to reproduce
There are lot of errors in Drupal logs but I am not sure how or from where this is producing.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | block_visibility_groups-fix_required_contexts_without_value-3476824-4.patch | 910 bytes | berramou |
Issue fork block_visibility_groups-3476824
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
berramou commentedI'm getting the same error
Comment #3
berramou commentedHere is how to reproduce this error:
You will have this error, it seems that the node (maybe any other entity type) it's required in the context, it seems that module evaluate the condition even if the context don't have value.
this line of code who throw the exception
$this->contextHandler->applyContextMapping($condition, $contexts);because the $contexts will have
["@node.node_route_context:node" => "contextValue":protected]=> NULL ]Comment #4
berramou commentedHere is a patch needs reviews, the idea is to filter out the contexts without value before passing them to applyContextMapping.
Comment #5
berramou commentedComment #6
jbowm2 commentedI am seeing a similar issue but it's not quite the same:
Drupal\Component\Plugin\Exception\ContextException: Assigned contexts were not satisfied: node in /app/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:145the error log is quite long. Hoped this patch might solve my issue but i am still seeing the same error in the logs
Comment #7
berramou commentedAh i don't have this error,
I guess it's better to create a new issue and make it a follow up to this one, and describe what Block Visibility Groups you have.
Comment #8
kasey_mk commentedWe were encountering this error on Views-created search pages (like one at /path) with Block Visibility Groups with two "request path "conditions (Return true on the following pages: /path* and Do not return true on the following pages: /path/*)
The patch in #4 does make the errors go away, and I still see the things governed by the correct Block Visibility Group on the Views page at /path and /path?query=etc but not on a node at /path/test - just as I expect.
Thanks!
Comment #9
smustgrave commentedpatch #4 worked for us too. Want to turn to an MR.
Comment #11
damienmckennaComment #12
damienmckennaCommitted. Thank you!
Comment #15
jwilson3Sadly this is filling up our logs too, and the patch on #4 and applies cleanly to 2.0.3 but not 2.0.4. The commit to the 2.1.x branch also doesnt apply to 2.0.4 therefore I presume that the 2.1.x branch has diverged quite a bit from the 2.0.x branch, meaning this needs a reroll until 2.1.x is stable.
Comment #16
jwilson3Ah. I just found that the fix for the same issue on the 2.0.x branch was done in a separate issue and there was no mention of that from this issue... So I'm linking these now. 😅
#3487237: MissingValueContextException: Required contexts without a value: node