Class "DeviceDetector\ClientHints" not found

Created on 29 July 2024, 5 months ago
Updated 15 August 2024, 4 months ago

Problem/Motivation

I don't know what's wrong, everything looks fine, but the visitor it's not recording data, and the report shows an "Error:Drupal\visitors\Service\DeviceService->getDeviceDetector() of Class "DeviceDetector\ClientHints" not found (/***/modules/contrib/visitors/src/Service/DeviceService.php line 55)."

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Fixed

Version

2.19

Component

Miscellaneous

Created by

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

Comments & Activities

  • Issue created by @liriji77
  • Issue was unassigned.
  • I'm encountering the same error where Total Visitors are not being counted even after installing this module. Here are the versions of Drupal and the module I'm using. I have also attached the error logs for further details.

    - Drupal Version
    10.3.1
    - PHP Version
    8.2.21
    - DataBase
    Version : 10.4.25-MariaDB-log
    System : MariaDB

    Log Details
    Type : php
    message : Error: Class "DeviceDetector\ClientHints" not found in Drupal\visitors\Service\DeviceService->getDeviceDetector() (line 55 of /code/web/modules/visitors/src/Service/DeviceService.php).
    Backtrace :
    #0 /code/web/modules/visitors/src/Service/TrackerService.php(303): Drupal\visitors\Service\DeviceService->getDeviceDetector('Mozilla/5.0 (Wi...', Array)
    #1 /code/web/modules/visitors/src/Service/TrackerService.php(181): Drupal\visitors\Service\TrackerService->doDeviceDetect(Array)
    #2 /code/web/modules/visitors/src/Controller/Visitors.php(60): Drupal\visitors\Service\TrackerService->log(Array)
    #3 [internal function]: Drupal\visitors\Controller\Visitors->track()
    #4 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #5 /code/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #6 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #7 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #8 /code/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #9 /code/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #10 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #11 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #12 /code/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #13 /code/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #14 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /code/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /code/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /code/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #22 {main}

  • 🇺🇸United States bluegeek9

    Did you use composer? composer require 'drupal/visitors:^2.19'

    It looks like the DeviceDetect library is missing. If you used composer, DeviceDetect should be installed.

  • Thank you very much.
    This problem was solved after I reinstalled visitor in composer.
    The problem may have been caused by manually updating the module after I moved the project to a new environment.

  • Status changed to Fixed 5 months ago
  • Thank you very much.
    I solved the problem by installing visitor with composer.

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

Production build 0.71.5 2024