diff --git a/src/Sentry/Laravel/Tracing/ServiceProvider.php b/src/Sentry/Laravel/Tracing/ServiceProvider.php index 7b169c07..b9e524b4 100644 --- a/src/Sentry/Laravel/Tracing/ServiceProvider.php +++ b/src/Sentry/Laravel/Tracing/ServiceProvider.php @@ -61,6 +61,12 @@ public function register(): void $this->app->singleton(Middleware::class, function () { $continueAfterResponse = ($this->getTracingConfig()['continue_after_response'] ?? true) === true; + // Lumen introduced the `terminating` method in version 9.1.4. + // We check for it's existence and disable the continue after response feature if it's not available. + if (!method_exists($this->app, 'terminating')) { + $continueAfterResponse = false; + } + return new Middleware($this->app, $continueAfterResponse); }); }