Sentry is already added according to the official Sentry in Next.js guide.
There are two configs sentry.client.config.js
and sentry.server.config.js
. Both requires DNS to be filled or supplied by SENTRY_DSN
respectively NEXT_PUBLIC_SENTRY_DSN
env variable in build / runtime.
Once you're don, all unhandled app errors are sent to the Sentry.
Errors are captured and sent to the Sentry, but app is still gonna break. To handle it and display crash screen rather than broken web to the user, use Sentry Error Boundary.
If you want to generate and upload source maps and create release in Sentry, fill up sentry.properties
and .sentryclirc
configs as described here.