File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
packages/nextjs/src/utils Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -329,14 +329,21 @@ function makeWrappedMethodForGettingParameterizedPath(
329329 origMethod : ApiPageEnsurer | PageComponentFinder ,
330330) : WrappedApiPageEnsurer | WrappedPageComponentFinder {
331331 // eslint-disable-next-line @typescript-eslint/no-explicit-any
332- const wrappedMethod = async function ( this : Server , parameterizedPath : string , ...args : any [ ] ) : Promise < any > {
332+ const wrappedMethod = async function (
333+ this : Server ,
334+ parameterizedPath : string | { pathname : string } ,
335+ ...args : any [ ]
336+ ) : Promise < any > {
333337 const transaction = getActiveTransaction ( ) ;
334338
335339 // replace specific URL with parameterized version
336340 if ( transaction && transaction . metadata . requestPath ) {
337341 const origPath = transaction . metadata . requestPath ;
338- const newName = transaction . name . replace ( origPath , parameterizedPath ) ;
339- transaction . setName ( newName , 'route' ) ;
342+ const newPath = typeof parameterizedPath === 'string' ? parameterizedPath : parameterizedPath . pathname ;
343+ if ( newPath ) {
344+ const newName = transaction . name . replace ( origPath , newPath ) ;
345+ transaction . setName ( newName , 'route' ) ;
346+ }
340347 }
341348
342349 return origMethod . call ( this , parameterizedPath , ...args ) ;
You can’t perform that action at this time.
0 commit comments