Skip to content

Lumen does not have the Illuminate\Routing\Events\RouteMatched event. #821

Closed
@summerKK

Description

@summerKK

How do you use Sentry?

Self-hosted / on-premises

SDK version

4.1

Steps to reproduce

Lumen uses nikic/fast-route instead of illuminate/routing. This event will not be triggered, causing tracing information to be unable to be reported. $this->didRouteMatch is always false

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

  public function terminate(Request $request, $response): void
  {
      // If there is no transaction or the HubInterface is not bound in the container there is nothing for us to do
      if ($this->transaction === null || !$this->app->bound(HubInterface::class)) {
          return;
      }

      // We stop here if a route has not been matched unless we are configured to trace missing routes
      if (!$this->didRouteMatch && config('sentry.tracing.missing_routes', false) === false) {
          return;
      }
  }

If it's lumen, can we just determine didRouteMatch based on $response->getStatusCode() === 404

Expected result

Report normally

Actual result

Unable to report

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Waiting for: Product Owner

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions