-
-
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
Next.js middleware support #4206
Comments
Anyone have a draft of how to make this happen while the feature gets developed? |
Sharing input from another channel here
|
Given that middleware in Next.js is still in beta (now more explicitly displayed) and under rapid development, I will close this issue until their API is stable. |
@vladanpaunovic Is there a way to disable just the server part of |
@boennemann, you can't disable the server part in |
Feedback from Vercel:
reopoening issue. @lforst & @vladanpaunovic let's continue our conversation around E2E tests, canary releases, and how/if it could help us with such features |
https://nextjs.org/blog/next-12-2#middleware-stable With NextJs 12.2 there is stable middleware support |
Yeap, ideally not only middleware support but also the core of it, which is Edge Runtime ecosystem:
|
I believe this and this issue is one in the same as Next.js uses cloudflare workers for it's edge infra. I know this is an older issue just wanted to link them. I would also love this support. I was trying to use the new edge runtime but got the error below when trying to just use
|
Seeing the same error as @athammer. Is there still no way to disable the sentry server-side error capturing in |
@ndom91 For now you could try not calling Also wanna give a small update on this issue: We're currently discussing internally what it would take to make Next.js middleware support and/or an SDK for additional runtimes happen. We're definitely excited that the demand for the SDK is high and are looking forward to making this a reality. |
I ended up rewriting my one |
Ended up doing the same - very excited about this support though, middleware is so much faster. |
Okay this is now going to stop us from using Sentry in our production app. What's the ETA to get this working? |
hi all we did a write up on possible work we are considering: 2023 and the JavaScript SDK One of those items is in regards to support for WinterCG, which is ultimately the blocker for full support of Vercel Middlewares. See Edge Middleware Limitations As a solution to help people who are blocked until then we will adding an option that allows users to opt out. |
What's up everybody, we finally released version To get errors and transactions for your middleware, simply update the SDK to the newest version and add a // sentry.edge.config.js or sentry.edge.config.ts
import * as Sentry from "@sentry/nextjs";
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({
dsn: SENTRY_DSN || "YOUR DSN HERE",
tracesSampleRate: 1.0,
}); For more info on this see the docs: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ Let us know if you find any issues! |
After adding & configured the sentry.edge.config.js, I ran some test with the v7.36 on client / serverless & edge runtime (same environment) by:
It's working properly on the client & serverless functions, but any Sentry request triggered from the edge runtime is ignored and won't show up in Sentry. |
@mrgnou Hi, can you share a small reproduction example? Thanks! |
@lforst Thanks for the feature! However I run my nextjs app in a personal instance not in Vercel. So I don't actually need this config file I think, but It keeps telling below message. How can I turn off this? 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()" |
@codemilli Even if you are not deploying to Vercel, Next.js will use the edge runtime for middleware and edge routes. That means, if you want Sentry to collect errors for middleware, you need |
@lforst Thanks for the comment! sorry for misunderstanding by just reading the name 🙏 |
The middleware is a new feature in Next.js v12, currently not supported by the Next.js SDK. The release blog post says it's in beta, but the middleware docs aren't that specific and don't say whether it's a prerelease.
what to cover:
The text was updated successfully, but these errors were encountered: