When we go to "/admin/structure/scripts/add"
And we do have the "google_tag" module enabled
We get the following Fatal error

The website encountered an unexpected error. Please try again later.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "domain.negotiator". in Drupal\Component\DependencyInjection\Container->get() (line 153 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\google_tag\Plugin\Condition\Domain::create(Object, Array, 'gtag_domain', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('gtag_domain', Array) (Line: 59)
Drupal\Core\Condition\ConditionManager->createInstance('gtag_domain', Array) (Line: 145)
Drupal\script_manager\Form\ScriptForm->buildVisibilityForm(Object) (Line: 115)
Drupal\script_manager\Form\ScriptForm->form(Array, Object) (Line: 149)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 520)
Drupal\Core\Form\FormBuilder->retrieveForm('script_form', Object) (Line: 277)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
omar alahmed’s picture

Status: Active » Closed (works as designed)

@RajabNatshah It's related to google tag manager domain condition plugin (\Drupal\google_tag\Plugin\Condition\Domain), it requires the domain navigator service without checking if the domain module is enabled. #3138445: Requested a non-existent service "domain.negotiator"

Temporary fix until patching google tag manager: download and enable domain module.

rajab natshah’s picture

Thank you Omar :) for following up
moving to your reported #3138445: Requested a non-existent service "domain.negotiator"

mohammed j. razem’s picture

Status: Closed (works as designed) » Active

Reopening.

The issue seems to be in line 162 of script_manager/src/Form/ScriptForm.php.
The method getEnabledVisibilityDefinitions() calls $this->conditionManager->getDefinitions(); to get the list of Context Aware plugins, which will return all plugins in this case.

I looked into core's Block implementation of the Context Aware Plugins that provide visibility conditions, the method used getFilteredDefinitions().

So I changed the code to $definitions = $this->conditionManager->getFilteredDefinitions(‘script_manager’); and things worked properly.

mohammed j. razem’s picture

Status: Active » Needs review
StatusFileSize
new726 bytes

And here's a patch to provide a base to work on.

larowlan’s picture

Status: Needs review » Closed (won't fix)

The issue here is the google tag manager module

borisr’s picture

Status: Closed (won't fix) » Needs review

The patch from #6 seems like the correct solution for this issue.
The patch will make sure the google_tag_plugin_filter_condition_alter gets executed and only the correct conditions will show up in the results.

capysara’s picture

I'm not sure where this issue stands, but the patch applies cleanly and allows me to access /admin/structure/scripts/add without hitting the error described in the issue summary.

larowlan’s picture

Status: Needs review » Fixed

Thanks folks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.