Problem/Motivation

Whe I try to update the module from 1.4 to 1.5 the whole website is broken and there is an error shown on top:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 2 passed to Drupal\google_tag\Entity\ContainerManager::__construct() must implement interface Drupal\Core\Config\ConfigFactoryInterface, instance of Drupal\Core\Extension\ModuleHandler given, called in /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\google_tag\Entity\ContainerManager->__construct() (line 67 of modules/contrib/google_tag/src/Entity/ContainerManager.php).

Drupal\google_tag\Entity\ContainerManager->__construct(Object, Object, Object, Object, Object) (Line: 262)
Drupal\Component\DependencyInjection\Container->createService(Array, 'google_tag.container_manager') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('google_tag.container_manager') (Line: 197)
Drupal::service('google_tag.container_manager') (Line: 69)
google_tag_page_attachments(Array) (Line: 313)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}(Object, 'google_tag') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('page_attachments', Object) (Line: 314)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 288)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

vuil created an issue. See original summary.

avpaderno’s picture

Version: 8.x-1.5 » 8.x-1.x-dev
solotandem’s picture

Category: Bug report » Support request

The arguments in google_tag.services.yml file agree with the __construct function signature in ContainerManager.php. So the error you report should not occur.

Please complete the steps to reproduce section of the issue template. What details are missing? Core release for example.

avpaderno’s picture

Did you run update.php? When a service arguments are changed, errors like that are shown because the DI container hasn't been rebuilt. Running update.php should rebuild it.

solotandem’s picture

Status: Active » Fixed

@apaderno Good point. Running update.php is highly recommended whenever code is updated. It is NOT always necessary, but if a user is not aware of the conditions that make it optional, then they should consider it a MUST do. Thanks.

@vuil If this suggestion did not resolve the issue, then please elaborate.

Status: Fixed » Closed (fixed)

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

tzt20’s picture

I had this identical issue when upgrading from 1.4 to 1.5, so I've been pinned to 1.4 for a while now. Recently revisited since I had some time for additional testing. There's no associated db update, ran drush updb anyway, still an issue. Core 9.4.8, PHP 8.0.23. Though, this release had the same issue on PHP 7.4 for me.

roaldnel’s picture

I know this has been closed but I encountered the same issue when I updated one of our servers from 1.6 to 1.7. Did anyone find a solution to this issue?