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

Sign up
Appearance settings

Sentry not reporting exceptions on Vapor #848

Unanswered
sweebee asked this question in Q&A
Discussion options

I've added sentry to my project running on Laravel Vapor. But it's not logging any exceptions.

I've even added the sdn to the config file itself:

<?php 
return [
 'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN', 'https://60926bexxxxxxxxxxxxxx')),
 ...
];

Added the exception handler:

/**
 * Register the exception handling callbacks for the application.
 */
 public function register() {
 $this->reportable(function (Throwable $e) {
 if (app()->bound('sentry')) {
 app('sentry')->captureException($e);
 }
 });
 }

Also added the log channel:

...
 'vapor' => [
 'driver' => 'stack',
 'channels' => ['sentry', 'stderr'],
 ],
'sentry' => [
 'driver' => 'sentry',
 ],

Am I doing anything wrong?

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

I do get info logs btw, but no exception logs.

You must be logged in to vote
3 replies
Comment options

https://docs.sentry.io/platforms/php/guides/laravel/

I set up a project on Vapor today, and everything is working just fine following the docs one by one.

Comment options

I noticed that some exceptions work and others don't.

I tried to change it to this (removed the bind check):

/**
 * Register the exception handling callbacks for the application.
 */
 public function register() {
 $this->reportable(function (Throwable $e) {
 app('sentry')->captureException($e);
 });
 }

and then I get an lambda error:

{"message":"Internal Server Error"}

So the app()->bound('sentry') returns false.

Comment options

Please use

use Sentry\Laravel\Integration;
public function register(): void
{
 $this->reportable(function (Throwable $e) {
 Integration::captureUnhandledException($e);
 });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /