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
Reacted by Bobby George, Mike Stop Continues, Tinker, Jan, Piotr Hebda, Merlin Mason, Chris Domigan, Damian Senn, Valentin Hervieu, Chris Schneider and 16 more
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.
reopoening issue. @lforst & @vladanpaunovic let's continue our conversation around E2E tests, canary releases, and how/if it could help us with such features
Reacted by Vladan Paunovic, Damian Senn and Sharif Shameem
@ndom91 For now you could try not calling Sentry.init() in sentry.server.config.js and removing all the imports there, or you could uninstall the Next.js package and use @sentry/browser instead. Both are a bit ugly but I would have to experiment a bit to find a potentially cleaner solution.
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.
Reacted by Jökull Sólberg Auðunsson, Nico Domino, Damian Senn, David Graham, Connor Walsh, José Ribeiro, Joe and Benjamin Dobson
Reacted by Nico Domino, Damian Senn, José Ribeiro and Martin Allard
I ended up rewriting my one runtime: experimental-edge route to just be a normal node style API route for now to keep server-side error capturing everywhere else as well. Thanks for the quick reply though and best of luck!
I ended up rewriting my one runtime: experimental-edge route to just be a normal node style API route for now to keep server-side error capturing everywhere else as well. Thanks for the quick reply though and best of luck!
Ended up doing the same - very excited about this support though, middleware is so much faster.
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 7.31.0 of the SDK which adds support for Next.js middleware.
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 file in the root of your project:
// sentry.edge.config.js or sentry.edge.config.tsimport*asSentryfrom"@sentry/nextjs";constSENTRY_DSN=process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN;Sentry.init({dsn: SENTRY_DSN||"YOUR DSN HERE",tracesSampleRate: 1.0,});
Reacted by Connor Bär, Helder Santana, Robin Curbelo, Connor Walsh, Léo Chéron, Nico Domino, Daniel Dyrnes, Samuel Mitas, Stefano Guglielmi, Minh-Phuc Tran and 1 more
Reacted by Jökull Sólberg Auðunsson, Wojciech, Brad, Helder Santana, Robin Curbelo, Nico Domino, Daniel Dyrnes, Samuel Mitas and Minh-Phuc Tran
What's up everybody, we finally released version 7.31.0 of the SDK which adds support for Next.js middleware.
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 file in the root of your project:
// sentry.edge.config.js or sentry.edge.config.tsimport*asSentryfrom"@sentry/nextjs";constSENTRY_DSN=process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN;Sentry.init({dsn: SENTRY_DSN||"YOUR DSN HERE",tracesSampleRate: 1.0,});
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.
What's up everybody, we finally released version 7.31.0 of the SDK which adds support for Next.js middleware.
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 file in the root of your project:
// sentry.edge.config.js or sentry.edge.config.tsimport*asSentryfrom"@sentry/nextjs";constSENTRY_DSN=process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN;Sentry.init({dsn: SENTRY_DSN||"YOUR DSN HERE",tracesSampleRate: 1.0,});
@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()"
@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?
@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 needsentry.edge.config.ts. If you don't want it to do anything, you can just make that file empty.
Activity
mikestopcontinues commentedon Jan 7, 2022
Anyone have a draft of how to make this happen while the feature gets developed?
smeubank commentedon May 19, 2022
Sharing input from another channel here
https://nextjs.org/docs/api-reference/edge-runtime
vladanpaunovic commentedon Jun 8, 2022
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.
boennemann commentedon Jun 12, 2022
@vladanpaunovic Is there a way to disable just the server part of
@sentry/nextjs? Because while I understand that you don't want to support beta/middleware this also blocking any adoption of https://nextjs.org/docs/advanced-features/react-18/switchable-runtime now.vladanpaunovic commentedon Jun 13, 2022
@boennemann, you can't disable the server part in
@sentry/nextjsat the moment, but what you can do is use @sentry/react in the meantime.smeubank commentedon Jun 20, 2022
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
7 remaining items
lforst commentedon Sep 13, 2022
@ndom91 For now you could try not calling
Sentry.init()insentry.server.config.jsand removing all theimports there, or you could uninstall the Next.js package and use@sentry/browserinstead. Both are a bit ugly but I would have to experiment a bit to find a potentially cleaner solution.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.
ndom91 commentedon Sep 15, 2022
I ended up rewriting my one
runtime: experimental-edgeroute to just be a normal node style API route for now to keep server-side error capturing everywhere else as well. Thanks for the quick reply though and best of luck!jokull commentedon Sep 15, 2022
Ended up doing the same - very excited about this support though, middleware is so much faster.
bramski commentedon Oct 26, 2022
Okay this is now going to stop us from using Sentry in our production app. What's the ETA to get this working?
smeubank commentedon Nov 3, 2022
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.
PR here: #6125
Original issue here: #6119
lforst commentedon Jan 16, 2023
What's up everybody, we finally released version
7.31.0of the SDK which adds support for Next.js middleware.To get errors and transactions for your middleware, simply update the SDK to the newest version and add a
sentry.edge.config.jsorsentry.edge.config.tsfile in the root of your project: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!
leo-cheron commentedon Feb 5, 2023
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.
lforst commentedon Feb 6, 2023
@mrgnou Hi, can you share a small reproduction example? Thanks!
codemilli commentedon Apr 2, 2024
@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?
lforst commentedon Apr 2, 2024
@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
sentry.edge.config.ts. If you don't want it to do anything, you can just make that file empty.codemilli commentedon Apr 2, 2024
@lforst Thanks for the comment! sorry for misunderstanding by just reading the name 🙏