Skip to content

express dynamic routes #466

Closed
Closed

Description

@amitgilad3

I have a microservice that can handle dynamic routes.
i added dd-trace and now my application crashes every time somebody makes a request.
express": "^4.16.2"
express-promise-router: "^3.0.1",

example:
method: 'get'
route: '/:path(*)'

Error:
SyntaxError: Invalid regular expression: /^/(*)(?:/)?$/: Nothing to repeat
at new RegExp ()
at tokensToRegExp (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/node_modules/path-to-regexp/index.js:346:10)
at stringToRegexp (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/node_modules/path-to-regexp/index.js:288:10)
at pathToRegexp (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/node_modules/path-to-regexp/index.js:370:10)
at Object.test (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:131:19)
at Function.processParamsWithTrace [as process_params] (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:27:27)
at next (/Users/Amit/cocycles/bit/warehouse/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/Users/Amit/cocycles/bit/warehouse/node_modules/express/lib/router/index.js:174:3)
at Function.handleWithTracer [as handle] (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:12:21)
at Layer.router (/Users/Amit/cocycles/bit/warehouse/node_modules/express/lib/router/index.js:47:12)
at web.wrapMiddleware (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:115:21)
at Scope._activate (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/scope/new/scope.js:38:14)
at Scope.activate (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/scope/new/base.js:13:17)
at Object.wrapMiddleware (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/util/web.js:90:27)
at callHandle (/Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:113:14)
at /Users/Amit/cocycles/bit/warehouse/node_modules/dd-trace/src/plugins/router.js:62:14

this only happens when i require dd-trace, when i run the application without data dog everything works
i think the issue is cause because im using express-promise-router and if so is there any solution ?

Activity

  1. rochdev commented on Feb 26, 2019

    @rochdev
    Member

    I'll have to look into it as it's not clear which component would cause this. express uses path-to-regexp internally which is the same library that we use in the integration, and is the one throwing.

  2. rochdev commented on Feb 26, 2019

    @rochdev
    Member

    I can replicate with only express and the same path, so definitely an issue with the integration's handling of paths.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions