You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`Cannot find '${possibilities[0]}' or '${possibilities[1]}' in '${projectDir}'.`);
363
+
// Edge config file is optional
364
+
if(platform==='edge'){
365
+
// eslint-disable-next-line no-console
366
+
console.warn(
367
+
'[@sentry/nextjs] You are using Next.js features that run on the Edge Runtime. Please add a "sentry.edge.config.js" or a "sentry.edge.config.ts" file to your project root in which you initialize the Sentry SDK with "Sentry.init()".',
368
+
);
369
+
return;
370
+
}else{
371
+
thrownewError(`Cannot find '${possibilities[0]}' or '${possibilities[1]}' in '${projectDir}'.`);
372
+
}
361
373
}
362
374
363
375
/**
@@ -449,11 +461,9 @@ function shouldAddSentryToEntryPoint(
449
461
isServer: boolean,
450
462
excludeServerRoutes: Array<string|RegExp>=[],
451
463
isDev: boolean,
452
-
isEdgeRuntime: boolean,
453
464
): boolean{
454
-
// We don't support the Edge runtime yet
455
-
if(isEdgeRuntime){
456
-
returnfalse;
465
+
if(entryPointName==='middleware'){
466
+
returntrue;
457
467
}
458
468
459
469
// On the server side, by default we inject the `Sentry.init()` code into every page (with a few exceptions).
@@ -479,9 +489,6 @@ function shouldAddSentryToEntryPoint(
479
489
// versions.)
480
490
entryPointRoute==='/_app'||
481
491
entryPointRoute==='/_document'||
482
-
// While middleware was in beta, it could be anywhere (at any level) in the `pages` directory, and would be called
483
-
// `_middleware.js`. Until the SDK runs successfully in the lambda edge environment, we have to exclude these.
484
-
entryPointName.includes('_middleware')||
485
492
// Newer versions of nextjs are starting to introduce things outside the `pages/` folder (middleware, an `app/`
486
493
// directory, etc), but until those features are stable and we know how we want to support them, the safest bet is
487
494
// not to inject anywhere but inside `pages/`.
@@ -552,13 +559,7 @@ export function getWebpackPluginOptions(
0 commit comments