File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed 
packages/tracing/src/integrations/node Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,24 @@ function instrumentRouter(appOrRouter: ExpressRouter): void {
259259  } 
260260
261261  const  router  =  isApp  ? appOrRouter . _router  : appOrRouter ; 
262+ 
263+   if  ( ! router )  { 
264+     /* 
265+     If we end up here, this means likely that this integration is used with Express 3 or Express 5. 
266+     For now, we don't support these version (3 is very old and 5 is still in beta). To support Express 5, 
267+     we'd need to make more changes to the routing instrumentation because the router is no longer part of 
268+     the Express core package but maintained in its own package. The new router has different function 
269+     signatures and works slightly differently, demanding more changes than just taking the router from 
270+     `app.router` instead of `app._router`. 
271+     @see  https://github.com/pillarjs/router 
272+ 
273+     TODO: Proper Express 5 support 
274+     */ 
275+     __DEBUG_BUILD__  &&  logger . debug ( 'Cannot instrument router for URL Parameterization (did not find a valid router).' ) ; 
276+     __DEBUG_BUILD__  &&  logger . debug ( 'Routing instrumentation is currently only supported in Express 4.' ) ; 
277+     return ; 
278+   } 
279+ 
262280  const  routerProto  =  Object . getPrototypeOf ( router )  as  ExpressRouter ; 
263281
264282  const  originalProcessParams  =  routerProto . process_params ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments