File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -53,13 +53,21 @@ export const config = {
53
53
} ,
54
54
} ;
55
55
56
- const isEdgeRuntime = origConfig . runtime === 'experimental-edge' ;
56
+ // This is a variable that Next.js will string replace during build with a string if run in an edge runtime from Next.js
57
+ // v12.2.1-canary.3 onwards:
58
+ // https://github.com/vercel/next.js/blob/166e5fb9b92f64c4b5d1f6560a05e2b9778c16fb/packages/next/build/webpack-config.ts#L206
59
+ // https://edge-runtime.vercel.sh/features/available-apis#addressing-the-runtime
60
+ declare const EdgeRuntime : string | undefined ;
57
61
58
- export default userProvidedHandler
59
- ? isEdgeRuntime
60
- ? userProvidedHandler
61
- : Sentry . withSentryAPI ( userProvidedHandler , '__ROUTE__' )
62
- : undefined ;
62
+ let exportedHandler ;
63
+
64
+ if ( typeof EdgeRuntime === 'string' ) {
65
+ exportedHandler = userProvidedHandler ;
66
+ } else {
67
+ exportedHandler = userProvidedHandler ? Sentry . withSentryAPI ( userProvidedHandler , '__ROUTE__' ) : undefined ;
68
+ }
69
+
70
+ export default exportedHandler ;
63
71
64
72
// Re-export anything exported by the page module we're wrapping. When processing this code, Rollup is smart enough to
65
73
// not include anything whose name matchs something we've explicitly exported above.
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ declare const __SENTRY_TRACING__: boolean;
34
34
// This is a variable that Next.js will string replace during build with a string if run in an edge runtime from Next.js
35
35
// v12.2.1-canary.3 onwards:
36
36
// https://github.com/vercel/next.js/blob/166e5fb9b92f64c4b5d1f6560a05e2b9778c16fb/packages/next/build/webpack-config.ts#L206
37
+ // https://edge-runtime.vercel.sh/features/available-apis#addressing-the-runtime
37
38
declare const EdgeRuntime : string | undefined ;
38
39
39
40
const globalWithInjectedValues = global as typeof global & {
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ const domain = domainModule as typeof domainModule & { active: (domainModule.Dom
33
33
// This is a variable that Next.js will string replace during build with a string if run in an edge runtime from Next.js
34
34
// v12.2.1-canary.3 onwards:
35
35
// https://github.com/vercel/next.js/blob/166e5fb9b92f64c4b5d1f6560a05e2b9778c16fb/packages/next/build/webpack-config.ts#L206
36
+ // https://edge-runtime.vercel.sh/features/available-apis#addressing-the-runtime
36
37
declare const EdgeRuntime : string | undefined ;
37
38
38
39
// Exporting this constant means we can compute it without the linter complaining, even if we stop directly using it in
You can’t perform that action at this time.
0 commit comments