Next.js Discord

Discord Forum

Handling Error Serialization and Digests in Next.js

Unanswered
HoracioGutierrez posted this in #help-forum
Open in Discord
Original message was deleted.

7 Replies

I recently came across a section in the official Next.js documentation that states, "When running next dev, the error will be serialized and forwarded from the Server Component to the client error.js. To ensure security when running next start in production, a generic error message is forwarded to error along with a .digest which contains a hash of the error message. This hash can be used to correspond to server logs."

I'm currently building an app deployed to Vercel, and I've noticed that the errors are not coming through as they're transformed into this digest so I'm not able to work with them in like specific form errors coming from a server action method. I understand that this is done for security reasons in production, but I'm wondering if there's a way to override this behavior and display the actual error messages instead of the digest.

Has anyone else experienced this issue or found a solution to it? I would appreciate any tips or advice , maybe i'm just dumb .

Thanks in advanced!
Dwarf Hotot
Hey @HoracioGutierrez have you solved this problem ?
I'm facing a strange behavior with error.tsx ... when I run the project with yarn dev it works perfectly, I can get the error message and display the correct error ui depending on the type of error, but when I yarn build && yarn start, I only get a generic error message like "an error occurred in a server component ...." and I lost the hability to display the correct message based on the type of the message ... could it be that error boundaries are not meant to be used like that ?
nope
I just gave up honestly
I thought about it but then I started to face some other dead ends like server actions not being able to SSG just because , and so on
so I think it's just like it is and stopped asking, like this is the third time I asked in a "Nextjs Community"