How to enable Next.js error handler in Production Deployment
Unanswered
Turkish Angora posted this in #help-forum
Turkish AngoraOP
Next.js has this awesome feature, where it displays thrown errors in a closeable toast which can be opened up in a dialog.
The problem that it only works in dev mode. Is it possible to use this feature in prod?
The problem that it only works in dev mode. Is it possible to use this feature in prod?
2 Replies
Turkish AngoraOP
No, that's meant to be shown only during development cause it might contain sensitive data. If you want to catch errors and show some useful information about them in production you have to use some kind of error boundary. The easiest option would be to use the
See: https://nextjs.org/docs/app/api-reference/file-conventions/error
error.js
file convention that's part of Next since v13.See: https://nextjs.org/docs/app/api-reference/file-conventions/error