Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method Laravel\Lumen\Application::terminating() #814

Closed
summerKK opened this issue Dec 8, 2023 · 3 comments · Fixed by #815
Closed

Call to undefined method Laravel\Lumen\Application::terminating() #814

summerKK opened this issue Dec 8, 2023 · 3 comments · Fixed by #815

Comments

@summerKK
Copy link
Contributor

summerKK commented Dec 8, 2023

How do you use Sentry?

Self-hosted / on-premises

SDK version

4.1

Steps to reproduce

When I use tracing to report data I get this error.

I use lumen. lumen version is v8.2.3

  Uncaught Error: Call to undefined method Laravel\Lumen\Application::terminating() in /Users/summer/Docker/www/x/vendor/sentry/sentry-laravel/src/Sentry/Larave  
  l/Tracing/Middleware.php:141                                                                                                                                                       
  Stack trace:                                                                                                                                                                       
  #0 /Users/summer/Docker/www/x/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(144): Sentry\Laravel\Tracing\Middleware->terminate(Object(Illumin  
  ate\Http\Request), Object(Illuminate\Http\Response))                                                                                                                               
  #1 [internal function]: Laravel\Lumen\Application->callTerminableMiddleware(Object(Illuminate\Http\Response))                                                                      
  #2 /Users/summer/Docker/www/x/vendor/hhxsv5/laravel-s/src/Illuminate/ReflectionApp.php(61): ReflectionMethod->invoke(Object(Laravel\Lumen\Application), Object  
  (Illuminate\Http\Response))                                                                                                                                                        
  #3 /Users/summer/Docker/www/x/vendor/hhxsv5/laravel-s/src/Illuminate/Laravel.php(151): Hhxsv5\LaravelS\Illuminate\ReflectionApp->callTerminableMiddleware(Obje  
  ct(Illuminate\Http\Response))                                                                                                                                                      
  #4 /Users/summer/Docker/www/x/vend   

vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php
image

I found that lumen version 9.x has this method. https://github.com/laravel/lumen-framework/blob/9.x/src/Application.php

A temporary workaround is to change the configuration in `sentry.php

    // Performance monitoring specific configuration
    'tracing' => [
        // Configures if the performance trace should continue after the response has been sent to the user until the application terminates
        // This is required to capture any spans that are created after the response has been sent like queue jobs dispatched using `dispatch(...)->afterResponse()` for example
        'continue_after_response' => env('SENTRY_TRACE_CONTINUE_AFTER_RESPONSE', false),
    ],

Do we need to update Lumen's documentation to avoid errors for others.? Or there are more elegant ways to deal with it

@stayallive
Copy link
Collaborator

The terminating was add in Lumen 9.1.4 even (with laravel/lumen-framework#1253) so not every 9.x release has it.

We should probably detect the missing terminating method and fallback to finish the transaction immediately if it's missing and thus not supported.

@stayallive
Copy link
Collaborator

I've opened #815 to fix this!

@cleptric
Copy link
Member

Fixed in 4.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants