ArgumentCountError: Too few arguments to function Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager::__construct(), 9 passed in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 11 expecte

Created on 18 May 2023, about 1 year ago
Updated 19 May 2023, about 1 year ago

Upgraded drupal core from 9.4.7 to 9.5.9 and this module was upgraded from dev-3.x to latest alpa (tried both).

After upgraded visting the node of a content type for which we use this module gives following error.

I tried both 3 and 4 branches as well restoring dev-3.x does not help.

Any help is highly appreciated as this is the only module preventing us to update the production server.

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager::__construct(), 9 passed in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 11 expected in Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager->__construct() (line 143 of modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterAppManager.php).
Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager->__construct(Object, Object, Object, Object, Object, Object, Object, Object, Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'xyz_frontend.google_analytics_counter_app_manager') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('xyz_frontend.google_analytics_counter_app_manager') (Line: 207)
Drupal::service('xyz_frontend.google_analytics_counter_app_manager') (Line: 676)
Drupal\xyz_frontend\TagMetaHelperService->setViewCount(Array, Object) (Line: 202)
_xyz_frontend_preprocess_node_meta(Array, Object) (Line: 21)
xyz_frontend_preprocess_node(Array, 'node', Array)
call_user_func_array('xyz_frontend_preprocess_node', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243)
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: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 116)
Drupal\cloudflare\CloudFlareMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Closed: works as designed

Version

4.0

Component

Code

Created by

πŸ‡©πŸ‡°Denmark monsoon

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

Comments & Activities

  • Issue created by @monsoon
  • πŸ‡©πŸ‡°Denmark monsoon

    Fixed this issue.

    A custom module implemented its own service class XyzGoogleAnalyticsCounterAppManager as follows:

    class XyzGoogleAnalyticsCounterAppManager extends GoogleAnalyticsCounterAppManager {
    ......................
    ............
    

    While in services.yml file passed 9 variables, I added remaining last two (, '@path.current', '@current_route_match']) as follows:

    xyz_frontend.google_analytics_counter_app_manager:
        class: \Drupal\xyz_frontend\XyzGoogleAnalyticsCounterAppManager
        arguments: ['@config.factory', '@database', '@state', '@path_alias.manager', '@path.matcher', '@language_manager', '@logger.channel.google_analytics_counter', '@messenger', '@google_analytics_counter.auth_manager', '@path.current', '@current_route_match']
    
  • Status changed to Closed: works as designed about 1 year ago
Production build 0.69.0 2024