-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Create simple Sentry example for exception reporting. #7360
Conversation
Stats from current PRClick to expand stats
Click to expand serverless stats
|
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.
@leerob Thank you 💯
Hello!
Thanks in advance for any tips! |
@raphaelpc any updates to the example are welcome 🙏 |
Overview
For many teams using Next.js, setting up exception monitoring is a critical requirement before going to production. The current with-sentry example, while thorough, is very complicated for beginners.
This PR adds a simple example showing how to use Sentry to catch & report errors on both client and server-side.
_document.js
is server-side only and is used to change the initial server-side rendered document markup. We listen at the node process level to capture exceptions._app.js
is client-side only and is used to initialize pages. We use thecomponentDidCatch
lifecycle method to catch uncaught exceptions.Note: Source maps will not be sent to Sentry when running locally. It's also possible you will see duplicate errors sent when testing locally due to hot reloading. For a more accurate simulation, please deploy to Now.
Testing
With the example deployed the Now, I can click the links to simulate errors.
Then, I'm able to see the errors flow into Sentry.
The errors are properly source mapped.
@lfades