-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nextjs): Auto-wrap edge-routes and middleware #6746
Conversation
size-limit report 📦
|
760df35
to
c31d07f
Compare
1eb3183
to
416a7c8
Compare
* This file is a template for the code which will be substituted when our webpack loader handles API files in the | ||
* `pages/` directory. | ||
* | ||
* We use `__RESOURCE_PATH__` as a placeholder for the path to the file being wrapped. Because it's not a real package, | ||
* We use `__SENTRY_WRAPPING_TARGET__` as a placeholder for the path to the file being wrapped. Because it's not a real package, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: should we call this __SENTRY_WRAPPING_TARGET_FILE__
to be a little more clear?
@@ -99,23 +99,61 @@ export function constructWebpackConfigFunction( | |||
|
|||
if (isServer) { | |||
if (userSentryOptions.autoInstrumentServerFunctions !== false) { | |||
const pagesDir = newConfig.resolve?.alias?.['private-next-pages'] as string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We looked at this really obscure field with a typecast here, and I am not sure if it is even part of the Next.js public API. Behavior around the pages
and pages/src
directory is pretty well defined here and it felt safer in the long run to just do the lookup ourselves. I guess it is not really required to be in this PR but snuck it in as a little cleanup.
Ref #6120
Ref #4206
Based on #6771, this PR adds automatic wrapping of Edge routes and Next.js middleware.