Merge pull request #8026 from cleptric/v5-develop

Update Sentry Laravel SDK to v3
This commit is contained in:
David Bomba 2022-12-05 10:43:31 +11:00 committed by GitHub
commit beb9a324b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 22 deletions

View File

@ -32,6 +32,7 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use PDOException; use PDOException;
use Sentry\Laravel\Integration;
use Sentry\State\Scope; use Sentry\State\Scope;
use Swift_TransportException; use Swift_TransportException;
use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\Console\Exception\CommandNotFoundException;
@ -84,7 +85,7 @@ class Handler extends ExceptionHandler
} }
if (Ninja::isHosted() && ! ($exception instanceof ValidationException)) { if (Ninja::isHosted() && ! ($exception instanceof ValidationException)) {
app('sentry')->configureScope(function (Scope $scope): void { Integration::configureScope(function (Scope $scope): void {
$name = 'hosted@invoiceninja.com'; $name = 'hosted@invoiceninja.com';
if (auth()->guard('contact') && auth()->guard('contact')->user()) { if (auth()->guard('contact') && auth()->guard('contact')->user()) {
@ -104,9 +105,9 @@ class Handler extends ExceptionHandler
]); ]);
}); });
app('sentry')->captureException($exception); Integration::captureUnhandledException($exception);
} elseif (app()->bound('sentry') && $this->shouldReport($exception)) { } elseif (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->configureScope(function (Scope $scope): void { Integration::configureScope(function (Scope $scope): void {
if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) { if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
$scope->setUser([ $scope->setUser([
'id' => auth()->guard('contact')->user()->company->account->key, 'id' => auth()->guard('contact')->user()->company->account->key,
@ -123,7 +124,7 @@ class Handler extends ExceptionHandler
}); });
if ($this->validException($exception)) { if ($this->validException($exception)) {
app('sentry')->captureException($exception); Integration::captureUnhandledException($exception);
} }
} }

View File

@ -76,7 +76,7 @@
"pragmarx/google2fa": "^8.0", "pragmarx/google2fa": "^8.0",
"turbo124/predis": "^1.1", "turbo124/predis": "^1.1",
"razorpay/razorpay": "2.*", "razorpay/razorpay": "2.*",
"sentry/sentry-laravel": "^2", "sentry/sentry-laravel": "^3",
"setasign/fpdf": "^1.8", "setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.3", "setasign/fpdi": "^2.3",
"socialiteproviders/apple": "^5.2", "socialiteproviders/apple": "^5.2",

33
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a27743d9d10e85380cec2a67aeb6d77c", "content-hash": "451d3dbdd5b0a87940e0f8fffadab4ae",
"packages": [ "packages": [
{ {
"name": "afosto/yaac", "name": "afosto/yaac",
@ -8121,37 +8121,42 @@
}, },
{ {
"name": "sentry/sentry-laravel", "name": "sentry/sentry-laravel",
"version": "2.14.2", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/getsentry/sentry-laravel.git", "url": "https://github.com/getsentry/sentry-laravel.git",
"reference": "4538ed31d77868dd3b6d72ad6e5e68b572beeb9f" "reference": "dd55f62a5b7bed0edabc5afcd04e5435713f57ae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/4538ed31d77868dd3b6d72ad6e5e68b572beeb9f", "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/dd55f62a5b7bed0edabc5afcd04e5435713f57ae",
"reference": "4538ed31d77868dd3b6d72ad6e5e68b572beeb9f", "reference": "dd55f62a5b7bed0edabc5afcd04e5435713f57ae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"illuminate/support": "5.0 - 5.8 | ^6.0 | ^7.0 | ^8.0 | ^9.0", "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0",
"nyholm/psr7": "^1.0", "nyholm/psr7": "^1.0",
"php": "^7.2 | ^8.0", "php": "^7.2 | ^8.0",
"sentry/sdk": "^3.1", "sentry/sdk": "^3.3",
"sentry/sentry": "^3.3", "sentry/sentry": "^3.10",
"symfony/psr-http-message-bridge": "^1.0 | ^2.0" "symfony/psr-http-message-bridge": "^1.0 | ^2.0"
}, },
"conflict": {
"laravel/lumen-framework": "*"
},
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.11", "friendsofphp/php-cs-fixer": "^3.11",
"laravel/framework": "5.0 - 5.8 | ^6.0 | ^7.0 | ^8.0 | ^9.0", "laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0",
"mockery/mockery": "^1.3", "mockery/mockery": "^1.3",
"orchestra/testbench": "3.1 - 3.8 | ^4.7 | ^5.1 | ^6.0 | ^7.0", "orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0",
"phpunit/phpunit": "^5.7 | ^6.5 | ^7.5 | ^8.4 | ^9.3" "phpunit/phpunit": "^8.4 | ^9.3"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.x-dev", "dev-master": "3.x-dev",
"dev-2.x": "2.x-dev",
"dev-1.x": "1.x-dev",
"dev-0.x": "0.x-dev" "dev-0.x": "0.x-dev"
}, },
"laravel": { "laravel": {
@ -8193,7 +8198,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/getsentry/sentry-laravel/issues", "issues": "https://github.com/getsentry/sentry-laravel/issues",
"source": "https://github.com/getsentry/sentry-laravel/tree/2.14.2" "source": "https://github.com/getsentry/sentry-laravel/tree/3.1.1"
}, },
"funding": [ "funding": [
{ {
@ -8205,7 +8210,7 @@
"type": "custom" "type": "custom"
} }
], ],
"time": "2022-10-13T09:21:29+00:00" "time": "2022-11-14T11:55:52+00:00"
}, },
{ {
"name": "setasign/fpdf", "name": "setasign/fpdf",

View File

@ -4,8 +4,8 @@ return [
//'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), //'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
'dsn' => config('ninja.sentry_dsn'), 'dsn' => config('ninja.sentry_dsn'),
// capture release as git sha
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), 'release' => config('ninja.app_version'),
'breadcrumbs' => [ 'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs // Capture Laravel logs in breadcrumbs
@ -26,5 +26,4 @@ return [
// @see: https://docs.sentry.io/error-reporting/configuration/?platform=php#send-default-pii // @see: https://docs.sentry.io/error-reporting/configuration/?platform=php#send-default-pii
'send_default_pii' => false, 'send_default_pii' => false,
'release' => config('ninja.app_version'),
]; ];