Hello!
Problem: Sentry doesn't work without any errors
Environment: Laravel 5.6.15, Sentry ^0.8.0, Docker
Steps: install sentry, add SENTRY_DSN to .env and add to error handler
public function report(Exception $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
parent::report($exception);
}
Nothing happens, errors don't occur in dashboard.
I tried to php artisan senty:test and receive next:
[sentry] ERROR: Missing configuration for server
[sentry] ERROR: Missing configuration for public_key
[sentry] ERROR: Missing configuration for secret_key
[sentry] Client configuration:
-> server:
-> project: 1
-> public_key:
-> secret_key:
Did you publish the configuration with the following command?
php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"
There should be a sentry.php file in your config folder.
If there is, can the issue be config caching?
Try to run the following before the test command.
php artisan config:clear
@stayallive oh, sorry, it's real config cache issue, now sentry:test working. But error handler (report methpd) still doesn't do anything
If the test works the handler should also work unless the exception is marked as "do not report" ($this->shouldReport($exception)), is it an exception that is not caught and/or marked as "do not report"?
Laravel also excludes a few itself:
@stayallive no, I have Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException.
$doNotReport is empty
As you can see Laravel excludes that one by default (or well, it excludes any HttpException which NotFoundHttpException is based on: https://github.com/laravel/framework/blob/d36ae2327475f5bb352f1ef62f993a7f28627880/src/Illuminate/Foundation/Exceptions/Handler.php#L59
So it is excluded from being reported, you can override $internalDontReport in your handler if you do not want that or remove the && $this->shouldReport($exception) to simply log _all_ exceptions (but this can be quite noisy). https://github.com/laravel/framework/blob/d36ae2327475f5bb352f1ef62f993a7f28627880/src/Illuminate/Foundation/Exceptions/Handler.php#L56
@stayallive thx for the answer.
Overwriting $internalDontReport don't help, but removing && $this->shouldReport($exception) works like a charm, THX!
Perfect, let me know if you bump into anything else 馃憤
Same here, even config:clear doesn't work. I already have set the SENTRY_LARAVEL_DSN.
This is the output:
root@c148e1334738:/var/www# php artisan sentry:test
[sentry] ERROR: Missing configuration for secret_key
[sentry] Client configuration:
-> server: https://sentry.io/api/124xxxx/store/
-> project: 124xxxx
-> public_key: 10a2533e587c4ee5b44dxxxxxxxxxxxx
-> secret_key:
[sentry] Generating test event
[sentry] Sending test event with ID: 9f2d65820a6d4e94be50xxxxxxxxxxxx
.env

Handler.php

sentry.php

The error about missing the private key is correct, since I just noticed the CLI tester was not updated since the public keys are deprecated.
@andreshg112 have you tested if regular events are coming through?
(meanwhile I'm updating the tester command to not require the private key)
@andreshg112 0.9.2 was just released that fixes the sentry:test command, however if you are experiencing problems sending exception to Sentry not from that command please open a new issue so we can discuss furthur.
No errors now. Thank you, @stayallive!

Most helpful comment
@andreshg112 0.9.2 was just released that fixes the sentry:test command, however if you are experiencing problems sending exception to Sentry not from that command please open a new issue so we can discuss furthur.