@@ -45,8 +45,7 @@ test('Should create a transaction for route handlers and correctly set span stat
4545 expect ( routehandlerTransaction . contexts ?. trace ?. op ) . toBe ( 'http.server' ) ;
4646} ) ;
4747
48- // Will be resolved by https://github.com/vercel/next.js/issues/82612
49- test . fail ( 'Should record exceptions and transactions for faulty route handlers' , async ( { request } ) => {
48+ test ( 'Should record exceptions and transactions for faulty route handlers' , async ( { request } ) => {
5049 const errorEventPromise = waitForError ( 'nextjs-turbo' , errorEvent => {
5150 return errorEvent ?. exception ?. values ?. [ 0 ] ?. value === 'Dynamic route handler error' ;
5251 } ) ;
@@ -57,6 +56,28 @@ test.fail('Should record exceptions and transactions for faulty route handlers',
5756
5857 await request . get ( '/route-handlers/boop/error' ) . catch ( ( ) => { } ) ;
5958
59+ // Expect this to timeout due to upstream Next.js issue https://github.com/vercel/next.js/issues/82612
60+ // When the issue is fixed, this test should fail (because it won't timeout anymore)
61+ const timeoutDuration = 25000 ; // Less than the 30s test timeout
62+
63+ try {
64+ await Promise . race ( [
65+ Promise . all ( [ routehandlerTransactionPromise , errorEventPromise ] ) ,
66+ new Promise ( ( _ , reject ) =>
67+ setTimeout ( ( ) => reject ( new Error ( 'Expected timeout - upstream issue still exists' ) ) , timeoutDuration ) ,
68+ ) ,
69+ ] ) ;
70+
71+ // If we get here, the upstream issue has been fixed
72+ throw new Error ( 'Test should have timed out - upstream issue may be fixed.' ) ;
73+ } catch ( error ) {
74+ // Expected timeout - test passes
75+ if ( error instanceof Error && error . message . includes ( 'Expected timeout' ) ) {
76+ return ;
77+ }
78+ throw error ;
79+ }
80+
6081 const routehandlerTransaction = await routehandlerTransactionPromise ;
6182 const routehandlerError = await errorEventPromise ;
6283
0 commit comments