Next.js Discord

Discord Forum

An error occurred in the Server Components render. The specific message is omitted in production

Answered
Tan posted this in #help-forum
Open in Discord
TanOP
I'm encountering an error in a Next.js application that only occurs in the production environment, not in development. The issue is that when a user enters the wrong password, a toast message should display "Enter the wrong password." However, in the production environment, a different error message is shown:

"An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error."

Could you help me debug this issue?
Answered by B33fb0n3
errors can contain sesitive information. Because of that they are visible in development but not in production. You can take a look at this guide on what you need to change to display the actual error: https://joulev.dev/blogs/throwing-expected-errors-in-react-server-actions

TL;DR
Build a proper error handling system or use an existing one. I like to use https://next-safe-action.dev/
View full answer

5 Replies

Answer
Original message was deleted
As said: the error can contain sensitive information. Because ofthat it's omitted. Do this to show the actual error: https://nextjs-forum.com/post/1271440039213142058#message-1271441319184568414
@Tan solved?
TanOP
yes solved Thanks @B33fb0n3