#Handling Error Serialization and Digests in Next.js

7 messages · Page 1 of 1 (latest)

echo ridgeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
terse folio
#

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!

mortal elk
#

Hey @terse folio 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 ?

terse folio
#

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"