@@ -154,17 +154,17 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
154154 return (
155155 original : ( event : string , ...args : unknown [ ] ) => boolean ,
156156 ) : ( ( this : unknown , event : string , ...args : unknown [ ] ) => boolean ) => {
157- return function incomingRequest ( this : unknown , event : string , ...args : unknown [ ] ) : boolean {
157+ return function incomingRequest ( this : unknown , ... args : [ event : string , ...args : unknown [ ] ] ) : boolean {
158158 // Only traces request events
159- if ( event !== 'request' ) {
160- return original . apply ( this , [ event , ... args ] ) ;
159+ if ( args [ 0 ] !== 'request' ) {
160+ return original . apply ( this , args ) ;
161161 }
162162
163163 instrumentation . _diag . debug ( 'http instrumentation for incoming request' ) ;
164164
165165 const isolationScope = getIsolationScope ( ) . clone ( ) ;
166- const request = args [ 0 ] as http . IncomingMessage ;
167- const response = args [ 1 ] as http . OutgoingMessage ;
166+ const request = args [ 1 ] as http . IncomingMessage ;
167+ const response = args [ 2 ] as http . OutgoingMessage ;
168168
169169 const normalizedRequest = httpRequestToRequestData ( request ) ;
170170
@@ -202,12 +202,12 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
202202
203203 // If we don't want to extract the trace from the header, we can skip this
204204 if ( ! instrumentation . getConfig ( ) . extractIncomingTraceFromHeader ) {
205- return original . apply ( this , [ event , ... args ] ) ;
205+ return original . apply ( this , args ) ;
206206 }
207207
208208 const ctx = propagation . extract ( context . active ( ) , normalizedRequest . headers ) ;
209209 return context . with ( ctx , ( ) => {
210- return original . apply ( this , [ event , ... args ] ) ;
210+ return original . apply ( this , args ) ;
211211 } ) ;
212212 } ) ;
213213 } ;
0 commit comments