Next.js Discord

Discord Forum

How can I debug "An error occurred in the Server Components render."?

Answered
South Polar Skua posted this in #help-forum
Open in Discord
South Polar SkuaOP
Client Logs:
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.


This error occurs only on Vercel and not locally. How can I debug such errors?
Vercel server error logs are empty and the client logs are omitted.
Answered by Arinji
well its 2 things if you get a error, a normal prod error or something weird with vercel itself

1) Normal Prod Error can be found in the vercel logs or doing a local prod build
2) Something weird with vercel can be found in the vercel logs

For 2 if that dosent work + the local prod build.. only other thing you can do is log out errors till you find whats breaking vercel
View full answer

13 Replies

Dwarf Hotot
Hey my friend @South Polar Skua , 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 ... is it maybe that error boundaries are no meant to be used like this ?
------

the main headache is 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.
now idea how to fix this
i removed the digest property off the props
but it didnt work
South Polar SkuaOP
I haven't found a solution, but also didn't need to investigate further. However, my next step would've been to use vercel's cli to simulate a vercel env on my machine.
@South Polar Skua vercel is just prod
you can do a prod build locally
npm run build
npm run start
South Polar SkuaOP
Nope, that didn't raise the error. I think it had something to do with caching or a race-condition of some kind.
hm yea probably something with vercel's edge network then.. if you cant find the issue on the vercel logs, the best bet is to console log around till you find whats breaking
South Polar SkuaOP
So, if I understand correctly:
It's not possible to somehow debug such errors and get the real error that was hidden if deployed in Vercel? Only with console logs?
@South Polar Skua So, if I understand correctly: It's not possible to somehow debug such errors and get the real error that was hidden if deployed in Vercel? Only with console logs?
well its 2 things if you get a error, a normal prod error or something weird with vercel itself

1) Normal Prod Error can be found in the vercel logs or doing a local prod build
2) Something weird with vercel can be found in the vercel logs

For 2 if that dosent work + the local prod build.. only other thing you can do is log out errors till you find whats breaking vercel
Answer