Skip to content

Wrong transaction name if multiple routers match #6004

Closed
@Martomate

Description

@Martomate

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.16.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

My code looks roughly like this:

const app = express()

const APIv1 = Router()
APIv1.post('/test', ...)

const root = Router()

// Here's the important part
app.use('/api', root)
app.use('/api/v1', APIv1)

I then send POST /api/v1/test

Expected Result

The transaction name (in the Performance tab) should be POST /api/v1/test/

Actual Result

The transaction name is POST /api/api/v1/test/

It works if I swap the order of the routers:

app.use('/api/v1', APIv1)
app.use('/api', root)

This worked as expected in previous versions (at least in 6.17.8 but not in 7.13.0).

Metadata

Metadata

Assignees

Labels

Package: nodeIssues related to the Sentry Node SDK

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions