-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Automatically skip middleware requests for tunnel route #16812
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -107,17 +107,17 @@ function getFinalConfigObject( | |||||
showedExportModeTunnelWarning = true; | ||||||
// eslint-disable-next-line no-console | ||||||
console.warn( | ||||||
'[@sentry/nextjs] The Sentry Next.js SDK `tunnelRoute` option will not work in combination with Next.js static exports. The `tunnelRoute` option uses serverside features that cannot be accessed in export mode. If you still want to tunnel Sentry events, set up your own tunnel: https://docs.sentry.io/platforms/javascript/troubleshooting/#using-the-tunnel-option', | ||||||
'[@sentry/nextjs] The Sentry Next.js SDK `tunnelRoute` option will not work in combination with Next.js static exports. The `tunnelRoute` option uses server-side features that cannot be accessed in export mode. If you still want to tunnel Sentry events, set up your own tunnel: https://docs.sentry.io/platforms/javascript/troubleshooting/#using-the-tunnel-option', | ||||||
); | ||||||
} | ||||||
} else { | ||||||
const resolvedTunnelRoute = | ||||||
typeof userSentryOptions.tunnelRoute === 'boolean' | ||||||
typeof userSentryOptions.tunnelRoute === 'boolean' && userSentryOptions.tunnelRoute === true | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could simplify that, since we know it's a boolean once we pass
Suggested change
Perhaps a bit redundant otherwise |
||||||
? generateRandomTunnelRoute() | ||||||
: userSentryOptions.tunnelRoute; | ||||||
|
||||||
// Update the global options object to use the resolved value everywhere | ||||||
userSentryOptions.tunnelRoute = resolvedTunnelRoute; | ||||||
userSentryOptions.tunnelRoute = resolvedTunnelRoute || undefined; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that! 👍 Is there a reason why we want the value to be |
||||||
setUpTunnelRewriteRules(incomingUserNextConfigObject, resolvedTunnelRoute); | ||||||
} | ||||||
} | ||||||
|
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.
I don't think we need a
url
constant since we only use it once andnew URL(req.url)
is quite explanatoryWhat do you reckon?