Skip to content
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

Provide Next.js SDK users with a way to opt out certain routes to use different runtimes #6119

Closed
lforst opened this issue Nov 2, 2022 · 0 comments · Fixed by #6207
Closed
Assignees

Comments

@lforst
Copy link
Member

lforst commented Nov 2, 2022

Vercel allows users to use the Vercel Edge runtime for individual Next.js API routes.

Example:

export const config = {
  runtime: "experimental-edge",
};

export default (req) => new Response("Hello world!");

Our Next.js SDK breaks (i.e. crashes a route) when ran on this runtime. We should provide users with a way to opt out certain routes of being initialized with the Sentry SDK so that users can use the Edge runtime without their apps crashing.

@vladanpaunovic vladanpaunovic assigned lobsterkatie and unassigned lforst Nov 8, 2022
lobsterkatie added a commit that referenced this issue Nov 15, 2022
Currently, in the nextjs SDK, we inject the user's `Sentry.init()` code (by way of their `sentry.server.config.js` file) into all serverside routes. This adds a new option to the `sentry` object in `next.config.js` which allows users to prevent specific routes from being instrumented in this way. In this option, excluded routes can be specified using either strings (which need to exactly match the route) or regexes.

Note: Heavily inspired by #6125. h/t to @lforst for his work there. Compared to that PR, this one allows non-API routes to be excluded and allows excluded pages to be specified as routes rather than filepaths. (Using routes a) obviates the need for users to add `pages/` to the beginning of every entry, b) abstracts away the differences between windows and POSIX paths, and c) futureproofs users' config values against underlying changes to project file organization.)

Docs for this feature are being added in getsentry/sentry-docs#5789.

Fixes #6119.
Fixes #5964.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants