File tree 3 files changed +23
-0
lines changed
e2e-tests/test-applications/nextjs-app-dir
app/edge-server-components/error
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ export const dynamic = 'force-dynamic' ;
2
+
3
+ export const runtime = 'edge' ;
4
+
5
+ export default async function Page ( ) {
6
+ throw new Error ( 'Edge Server Component Error' ) ;
7
+ }
Original file line number Diff line number Diff line change
1
+ import { test , expect } from '@playwright/test' ;
2
+ import { waitForError } from '../event-proxy-server' ;
3
+
4
+ test ( 'Should record exceptions for faulty edge server components' , async ( { page } ) => {
5
+ const errorEventPromise = waitForError ( 'nextjs-13-app-dir' , errorEvent => {
6
+ return errorEvent ?. exception ?. values ?. [ 0 ] ?. value === 'Edge Server Component Error' ;
7
+ } ) ;
8
+
9
+ await page . goto ( '/edge-server-components/error' ) ;
10
+
11
+ expect ( await errorEventPromise ) . toBeDefined ( ) ;
12
+ } ) ;
Original file line number Diff line number Diff line change 1
1
import {
2
2
addTracingExtensions ,
3
3
captureException ,
4
+ flush ,
4
5
getCurrentHub ,
5
6
runWithAsyncContext ,
6
7
startTransaction ,
@@ -81,6 +82,7 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
81
82
maybePromiseResult = originalFunction . apply ( thisArg , args ) ;
82
83
} catch ( e ) {
83
84
handleErrorCase ( e ) ;
85
+ void flush ( ) ;
84
86
throw e ;
85
87
}
86
88
@@ -94,12 +96,14 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
94
96
handleErrorCase ( e ) ;
95
97
} ,
96
98
) ;
99
+ void flush ( ) ;
97
100
98
101
// It is very important that we return the original promise here, because Next.js attaches various properties
99
102
// to that promise and will throw if they are not on the returned value.
100
103
return maybePromiseResult ;
101
104
} else {
102
105
transaction . finish ( ) ;
106
+ void flush ( ) ;
103
107
return maybePromiseResult ;
104
108
}
105
109
} ) ;
You can’t perform that action at this time.
0 commit comments