Replies: 4 comments
-
I have just spent a day crafting nice errors and had to work around this problem. I definitely think this is something we should have so we don't need to propagate errors from through the application. |
Beta Was this translation helpful? Give feedback.
-
Full support!This next approach makes no sense, in my opinion. I'm building a fullstack app, using services and repositories to achieve a well-defined and reusable architecture. A service should return data or stop the flow if there is an error. It doesn't make sense to return objects with `{ error: 'error message' } instead of throwing errors. |
Beta Was this translation helpful? Give feedback.
-
That's why I'm switching out of nextjs, they think we're idiot and they wanna do all on their code, as if we don't know what error we can expose on the client. |
Beta Was this translation helpful? Give feedback.
-
It really sucks. This useless error messages show on staging environment and it makes hard to debug even on staging environment. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Background
Currently, in production builds, Next.js strips error messages and stack traces from Server Components (and Server Actions) and replaces them with a generic:
“An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details.”
While this behavior is great for security, it hinders real-world scenarios like:
Today, developers must implement awkward workarounds — catching errors on the server, converting them to serialized responses, and rebuilding custom error rendering logic.
Proposal
Introduce a mechanism that allows certain error types to opt-in to client-side exposure in production builds.
✅ Benefits
• Enables better user feedback on known errors (without losing security for unknown ones)
• Reduces boilerplate in Server Components and Actions
• Aligns with existing use cases in forms, authentication flows, and business logic
• Keeps current secure behavior as default (opt-in only)
Beta Was this translation helpful? Give feedback.
All reactions