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(
329
329
origMethod : ApiPageEnsurer | PageComponentFinder ,
330
330
) : WrappedApiPageEnsurer | WrappedPageComponentFinder {
331
331
// 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 > {
333
337
const transaction = getActiveTransaction ( ) ;
334
338
335
339
// replace specific URL with parameterized version
336
340
if ( transaction && transaction . metadata . requestPath ) {
337
341
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
+ }
340
347
}
341
348
342
349
return origMethod . call ( this , parameterizedPath , ...args ) ;
You can’t perform that action at this time.
0 commit comments