File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/Sentry/Laravel/Console Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ - Fix incorrect ` release ` and ` environment ` values when using the ` sentry:test ` command
6
+
5
7
## 2.12.0
6
8
7
9
- Add support for normalized route names when using [ Laravel Lumen] ( https://lumen.laravel.com/docs/9.x ) (#449 )
Original file line number Diff line number Diff line change 11
11
use Sentry \State \HubInterface ;
12
12
use Sentry \Tracing \SpanContext ;
13
13
use Sentry \Tracing \TransactionContext ;
14
+ use Throwable ;
14
15
15
16
class TestCommand extends Command
16
17
{
@@ -54,9 +55,20 @@ public function handle(): int
54
55
55
56
$ dsn = $ this ->option ('dsn ' );
56
57
58
+ $ laravelClient = null ;
59
+
60
+ try {
61
+ $ laravelClient = app (HubInterface::class)->getClient ();
62
+ } catch (Throwable $ e ) {
63
+ // Ignore any errors related to getting the client from the Laravel container
64
+ // These errors will surface later in the process but we should not crash here
65
+ }
66
+
57
67
// If the DSN was not passed as option to the command we use the registered client to get the DSN from the Laravel config
58
68
if ($ dsn === null ) {
59
- $ dsnObject = app (HubInterface::class)->getClient ()->getOptions ()->getDsn ();
69
+ $ dsnObject = $ laravelClient === null
70
+ ? null
71
+ : $ laravelClient ->getOptions ()->getDsn ();
60
72
61
73
if ($ dsnObject !== null ) {
62
74
$ dsn = (string )$ dsnObject ;
@@ -77,6 +89,8 @@ public function handle(): int
77
89
try {
78
90
$ clientBuilder = ClientBuilder::create ([
79
91
'dsn ' => $ dsn ,
92
+ 'release ' => $ laravelClient === null ? null : $ laravelClient ->getOptions ()->getRelease (),
93
+ 'environment ' => $ laravelClient === null ? null : $ laravelClient ->getOptions ()->getEnvironment (),
80
94
'traces_sample_rate ' => 1.0 ,
81
95
]);
82
96
} catch (Exception $ e ) {
You can’t perform that action at this time.
0 commit comments