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
6.19.7
Framework Version
6.19.7
Link to Sentry event
No response
Steps to Reproduce
Integrate sentry with an existing express app.
Use this to list routes:
importpathfrom'path'functiongetPathFromRegex(regexp){returnregexp.toString().replace('/^','').replace('?(?=\\/|$)/i','').replace(/\\\//g,'/')}functioncombineStacks(acc,stack){if(stack.handle.stack){constrouterPath=getPathFromRegex(stack.regexp)return[
...acc,
...stack.handle.stack.map((stack)=>({ routerPath, ...stack})),]}return[...acc,stack]}functiongetStacks(app){// Express 3if(app.routes){// convert to express 4returnObject.keys(app.routes).reduce((acc,method)=>[...acc, ...app.routes[method]],[]).map((route)=>({route: {stack: [route]}}))}// Express 4if(app._router&&app._router.stack){returnapp._router.stack.reduce(combineStacks,[])}// Express 4 Routerif(app.stack){returnapp.stack.reduce(combineStacks,[])}// Express 5if(app.router&&app.router.stack){returnapp.router.stack.reduce(combineStacks,[])}return[]}functionlistRoutes(app){conststacks=getStacks(app)constroutes=[]if(stacks){for(conststackofstacks){if(stack.route){constrouteLogged={}for(constrouteofstack.route.stack){constmethod=route.method ? route.method.toUpperCase() : nullif(!routeLogged[method]&&method){conststackPath=stack.routerPath||route.path
? path.resolve([stack.routerPath,stack.route.path,route.path].filter((s)=>!!s).join(''))
: stack.route.pathroutes.push({verb: method,path: stackPath})routeLogged[method]=true}}}}}returnroutes}exportdefaultlistRoutesExpected Result
routes listed and returned
Actual Result
after integration with Sentry, all route information disappears.
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
6.19.7
Framework Version
6.19.7
Link to Sentry event
No response
Steps to Reproduce
Integrate sentry with an existing express app.
Use this to list routes:
Expected Result
routes listed and returned
Actual Result
after integration with Sentry, all route information disappears.