sentry-laravel: Target class [hash] does not exist. When trying to install

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version? composer require sentry/sentry-laravel Laravel v7.30.6 PHP 7.4.27

Steps to Reproduce

Just in command line: composer require sentry/sentry-laravel

Expected Result

Sentry installed successfully

Actual Result

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi

   Illuminate\Contracts\Container\BindingResolutionException 

  Target class [hash] does not exist.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:811
    807| 
    808|         try {
    809|             $reflector = new ReflectionClass($concrete);
    810|         } catch (ReflectionException $e) {
    811|             throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
    812|         }
    813| 
    814|         // If the type is not instantiable, the developer is attempting to resolve
    815|         // an abstract type such as an Interface or Abstract Class and there is

      34 vendor frames 
  35  app/Console/Kernel.php:186
      Illuminate\Foundation\Console\Kernel::bootstrap()

      1 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16

Most upvoted comments

This does seem like a highly specific thing, even though we are triggering it a bit early this doesn’t seem like it would or should work honestly since the log format is calling the Auth::id() probably way before any actual code has run.

There doesn’t seem to be a way for us to register the custom logger without triggering your custom code. I could provide some change to the service provider allowing you to disable the logger registration, but if another package ever registers it’s own logger you are going to back at square 1 😃