File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
dev-packages/e2e-tests/test-applications/nextjs-16/tests Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,25 @@ test('Faulty middlewares', async ({ request }) => {
6161
6262test ( 'Should trace outgoing fetch requests inside middleware and create breadcrumbs for it' , async ( { request } ) => {
6363 test . skip ( isDevMode , 'The fetch requests ends up in a separate tx in dev atm' ) ;
64+
65+ // First, let's see what middleware transactions we get
66+ // FIXME: Remove this once we know what's going on
67+ const allMiddlewareTransactions : Event [ ] = [ ] ;
6468 const middlewareTransactionPromise = waitForTransaction ( 'nextjs-16' , async transactionEvent => {
65- return (
66- transactionEvent ?. transaction === 'middleware GET' &&
67- ! ! transactionEvent . spans ?. find ( span => span . op === 'http.client' )
68- ) ;
69+ console . log ( 'Transaction event:' , transactionEvent ?. transaction ) ;
70+ if ( transactionEvent ?. transaction === 'middleware GET' ) {
71+ allMiddlewareTransactions . push ( transactionEvent as any ) ;
72+ console . log (
73+ 'Found middleware transaction, spans:' ,
74+ transactionEvent . spans ?. map ( s => s . op ) ,
75+ ) ;
76+
77+ const hasHttpClientSpan = ! ! transactionEvent . spans ?. find ( span => span . op === 'http.client' ) ;
78+ if ( hasHttpClientSpan ) {
79+ return true ;
80+ }
81+ }
82+ return false ;
6983 } ) ;
7084
7185 request . get ( '/api/endpoint-behind-middleware' , { headers : { 'x-should-make-request' : '1' } } ) . catch ( ( ) => {
You can’t perform that action at this time.
0 commit comments