Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Last week I updated sentry to the latest version but stopped receiving errors into sentry. I have just reverted back to the previous working version. Any suggestions on what I'm doing wrong?

I was trying to follow the installation guide here:
https://docs.sentry.io/platforms/php/guides/laravel/

Handler.php

Working Code:

public function report(Throwable $exception)
    {
        if (app()->bound('sentry') && $this->shouldReport($exception)) {
            app('sentry')->captureException($exception);
        }
        parent::report($exception);
    }

Changed to this for latest version, but then no longer receiving errors:

public function register(): void
{
    $this->reportable(function (Throwable $e) {
            Integration::captureUnhandledException($e);
        });
        parent::register(); // TODO: Change the autogenerated stub
}
You must be logged in to vote

Can you try adding this to your sentry.php next to your other options:

	'logger' => new \Sentry\Logger\DebugFileLogger(storage_path('logs/sentry.log')),

Note: if you have config caching, disable it for a bit since this won't work with that!

This should write to storage/logs/sentry.log any internal logs from the SDK that might tell you what is not working. My first guess is that you don't have the cURL extension enabled for your web requests but do have it enabled on the CLI. The logs should surface that if that is the case.

Replies: 2 comments · 5 replies

Comment options

Which Laravel version are you using?

You must be logged in to vote
2 replies
@gwidgery
Comment options

Laravel 10

@cleptric
Comment options

Did you maybe forget to upgrade your laravel template along the line?
Looking at Laravel 10, there should be a register method https://github.com/laravel/laravel/blob/10.x/app/Exceptions/Handler.php

Comment options

After the migration, did you also run php artisan sentry:test to see if anything might be not working correctly?

You must be logged in to vote
3 replies
@gwidgery
Comment options

Yes, I ran php artisan sentry:test and that filed the test exception. It only seems to be the code generated exceptions that weren't working.

I ran this code

Route::get('/debug-sentry', function () {
    throw new Exception('My first Sentry error!');
});

and the exception renders in the browser, but nothing was sent to sentry.

@stayallive
Comment options

Can you try adding this to your sentry.php next to your other options:

	'logger' => new \Sentry\Logger\DebugFileLogger(storage_path('logs/sentry.log')),

Note: if you have config caching, disable it for a bit since this won't work with that!

This should write to storage/logs/sentry.log any internal logs from the SDK that might tell you what is not working. My first guess is that you don't have the cURL extension enabled for your web requests but do have it enabled on the CLI. The logs should surface that if that is the case.

Answer selected by gwidgery
@gwidgery
Comment options

Thanks - that's fixed it. Enabled logging and saw that the cURL extension wasn't enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.