Next.js · Senior · Question 12 of 75
Why does error.tsx in production get a generic message for an error from a server component?
- ✓Correct answer: Next.js hides the details and passes a
digestfor looking it up in logs - 2Server components can't throw errors with a message text
- 3The message is truncated to 20 characters to save payload size
Explanation
Error text can contain SQL, paths and secrets, so the client gets a generic message plus error.digest - a hash for finding the full error in server logs. In development the full message is available.