@@ -32,6 +32,10 @@ export async function handler(req: IncomingMessage, res: ServerResponse) {
3232 const userAgent = headers [ 'user-agent' ] || '' ;
3333 console . log ( `${ method } ${ headers . host } ${ url } ` ) ;
3434 console . log ( `user-agent: ${ userAgent } ` ) ;
35+ const reqId =
36+ String ( headers [ 'x-vercel-id' ] || '' )
37+ . split ( ':' )
38+ . pop ( ) || '' ;
3539 if (
3640 ! userAgent ||
3741 userAgent . startsWith ( 'node' ) ||
@@ -112,7 +116,7 @@ export async function handler(req: IncomingMessage, res: ServerResponse) {
112116 return res . end ( ) ;
113117 } catch ( e ) {
114118 res . setHeader ( 'Content-Type' , mimeType ( '*.html' ) ) ;
115- return renderPage ( res , pages . parseFailure , query , TMPDIR , GA_ID ) ;
119+ return renderPage ( res , pages . parseFailure , query , TMPDIR , GA_ID , reqId ) ;
116120 }
117121 } ) ;
118122 } else {
@@ -121,7 +125,7 @@ export async function handler(req: IncomingMessage, res: ServerResponse) {
121125 typeof query . p === 'string' && parsePackageString ( query . p ) . version !== null ;
122126 res . setHeader ( 'Content-Type' , mimeType ( '*.html' ) ) ;
123127 res . setHeader ( 'Cache-Control' , cacheControl ( isProd , isIndex || hasVersion ? 31 : 0 ) ) ;
124- renderPage ( res , pathname , query , TMPDIR , GA_ID ) ;
128+ renderPage ( res , pathname , query , TMPDIR , GA_ID , reqId ) ;
125129 }
126130 } catch ( e ) {
127131 console . error ( e ) ;
0 commit comments