Uncaught ReflectionException: Class sentry does not exist in /home/vagrant/code/skobdom/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 719
im just run artisan config:cache for get this issue
composer.json https://pastebin.com/raw/qycpc314
Going to get a Laravel 5.4 example in the app so we can try and reproduce any issues, but im not sure what the 'sentry' class could possibly be.
This sounds like you didnt follow the documentation. I reproduced this by only installing the package and not actually configuring it.
Please see the README or our docs for full installation instructions, there's some manual changes you must complete in your app when installing extensions.
All configured right. But now i have same error without artisan config:cache
PHP Fatal error: Uncaught ReflectionException: Class sentry does not exist in /srv/www/skobdom.dev.brcl.ru/vendor/laravel/framework/src/Illuminate/Container/Container.php:719
something wrong in pulling your class to Laravel service container.
i get error above when use artisan. for example add TEST_LOL=space between to .env file
and then run artisan cache:clear for example, and you got that error.
Im think way you add your provider to Laravel container not poperly work wit artisan... i dont know
You can do this to make it a bit simpeler:
public function report(Exception $e)
{
if (app()->bound('sentry') && $this->shouldReport($e)) {
app('sentry')->captureException($e);
}
parent::report($e);
}
Submitted pull request with README changes for this (#67).
thanks, work great
To elaborate for future readers (since I ran into this error a few times too)... if you have an error too early in the startup phase of Laravel (such as including another provider in a class you haven't loaded with composer install yet) then sentry can fail to be found in the app because it's not bound yet. The above code example by @stayallive allows sentry usage to fail silently, or more accurately, fall back to standard error reporting. Very helpful. Thanks!
@phpguru I just got the same issue trying to play with Service Provider...
My case: A provider needs another provider for DI. But It blows me the error as sentry does not exist.
Still didn't figure out why
Edit: Ok It was a f* mistake because the project has 2 composer.json and one is not used anymore, but sometimes I'm in the wrong directory for my docker command and beam I didn't execute the command from the container. Anyway ;)
Most helpful comment
You can do this to make it a bit simpeler:
Submitted pull request with README changes for this (#67).