Next.js Discord

Discord Forum

How to disable stack trace obfuscation in prod?

Answered
Iridescent shark posted this in #help-forum
Open in Discord
Iridescent sharkOP
To avoid showing sensitive information in production, NextJS removes the stack trace from errors thrown in server actions and server components, and replaces it with a digest. However this is really inconvenient for the vast majority of projects that have yet to launch. Is there a flag or some other code modification to disable this behavior from NextJS?
Answered by joulev
see how to handle expected errors versus unexpected errors: https://nextjs.org/docs/app/building-your-application/routing/error-handling
View full answer

7 Replies

see how to handle expected errors versus unexpected errors: https://nextjs.org/docs/app/building-your-application/routing/error-handling
Answer
Iridescent sharkOP
These errors are actual programming or logic errors it doesn't make sense to handle them
I want the application to fail (gracefull or not) but the important part is showing the stack trace instead of just a digest
then you should be using dev mode not prod mode
prod mode is not meant for applications still with logic/syntax errors in them
Iridescent sharkOP
Okay thanks!