Skip to content

TypeError: partialRoute.split is not a function when using array as path argument #5489

Description

@albanv

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/tracing

SDK Version

7.8.0

Framework Version

express 4.18.1, node 18.7.0

Link to Sentry event

https://sentry.io/organizations/eatwith/issues/3461507981/

Steps to Reproduce

  1. use sentry tracing express integration
  2. have a route declared with an array as path parameter route.get(['path', 'other_path', /regex_path/], (req, res, next) => {...
  3. try to access the route

As discussed in #5481 with @Lms24, in express arrays are also valids path parameters.
#5483 only fix the issue when using RegExp as path parameter.

Expected Result

The route handler should execute its actual logic

Actual Result

Sentry tracing express integration does crash

TypeError: partialRoute.split is not a function
File "/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js", line 220, col 8, in Function.process_params
.split('/')
File "/app/node_modules/express/lib/router/index.js", line 280, col 10, in next
self.process_params(layer, paramcalled, req, res, function (err) {
File "/app/node_modules/express/lib/router/index.js", line 175, col 3, in Function.handle
next();
File "/app/node_modules/express/lib/router/index.js", line 47, col 12, in router
router.handle(req, res, next);
File "/app/node_modules/express/lib/router/layer.js", line 95, col 5, in Layer.handle [as handle_request]
fn(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 328, col 13, in trim_prefix
layer.handle_request(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 286, col 9, in <anonymous>
trim_prefix(layer, layerError, layerPath, path)
File "/app/node_modules/express/lib/router/index.js", line 346, col 12, in Function.process_params
return done();
File "/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js", line 245, col 34, in Function.process_params
return originalProcessParams.call(this, layer, called, req, res, done);
File "/app/node_modules/express/lib/router/index.js", line 280, col 10, in next
self.process_params(layer, paramcalled, req, res, function (err) {
File "/app/node_modules/express/lib/router/index.js", line 646, col 15, in <anonymous>
return fn.apply(this, arguments);
File "/app/node_modules/express/lib/router/index.js", line 265, col 14, in next
return done(layerError);
File "/app/node_modules/express/lib/router/index.js", line 175, col 3, in Function.handle
next();
File "/app/node_modules/express/lib/router/index.js", line 47, col 12, in router
router.handle(req, res, next);
File "/app/node_modules/express/lib/router/layer.js", line 95, col 5, in Layer.handle [as handle_request]
fn(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 328, col 13, in trim_prefix
layer.handle_request(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 286, col 9, in <anonymous>
trim_prefix(layer, layerError, layerPath, path)
File "/app/node_modules/express/lib/router/index.js", line 346, col 12, in Function.process_params
return done();
File "/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js", line 245, col 34, in Function.process_params
return originalProcessParams.call(this, layer, called, req, res, done);
File "/app/node_modules/express/lib/router/index.js", line 280, col 10, in next
self.process_params(layer, paramcalled, req, res, function (err) {
File "/app/node_modules/express/lib/router/index.js", line 646, col 15, in <anonymous>
return fn.apply(this, arguments);
File "/app/node_modules/express/lib/router/index.js", line 265, col 14, in next
return done(layerError);
File "/app/node_modules/express/lib/router/index.js", line 175, col 3, in Function.handle
next();
File "/app/node_modules/express/lib/router/index.js", line 47, col 12, in router
router.handle(req, res, next);
File "/app/node_modules/express/lib/router/layer.js", line 95, col 5, in Layer.handle [as handle_request]
fn(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 328, col 13, in trim_prefix
layer.handle_request(req, res, next);
File "/app/node_modules/express/lib/router/index.js", line 286, col 9, in <anonymous>
trim_prefix(layer, layerError, layerPath, path)
File "/app/node_modules/express/lib/router/index.js", line 346, col 12, in Function.process_params
return done();
```

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions