How to fix or disable this error in production mode "An error occurred in the Server Components render..." #71099
-
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 7 replies
-
|
You have to look at the logs of your app, with the digest number you get in the error. That being said, I guess, the issue is at the login step. Could you add more logs to the login? |
Beta Was this translation helpful? Give feedback.
-
|
I have gotten a solution to it. So, the issue comes from the error logging to the terminal. In production nextjs try to protect the app from releasing sensitive information to client because it cannot tell if the error is internal or external. So, the solution was to find a different method to log the error to the user. "client side code (login page function)" "Server side code (Action)" |
Beta Was this translation helpful? Give feedback.
-
|
did you solve it ?? |
Beta Was this translation helpful? Give feedback.
-
|
This does not make sense. It's developer's responsibility to hide technical messages. In my case I have a BusinessError class inheriting from Error. This error type should be visible in client as is since I create messages for user :) There are solutions like returning some kind of object like: { status: "OK", result = ...} or { status: "Error", value: "Invalid usr/pwd combination } But in this case you cannot design a centralized error management/logging on server. You have to use try/catch statements inside all server actions. |
Beta Was this translation helpful? Give feedback.
-
|
I created an issue. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, I have a solution
…On Wed, May 14, 2025 at 7:08 AM mikey ***@***.***> wrote:
"Server side code (Action)"
Did you find a solution apart from hiding exception?
—
Reply to this email directly, view it on GitHub
<#71099 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIIR3VUMNBSQP2KQMNTWXID26LTWRAVCNFSM6AAAAABPXA44I2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMJUGA4DQOI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
The larger issue at hand is the lack of dev/prod parity, and this goes against the "principle of least astonishment." I have some sympathy for the fact that the Next team doesn't allow exceptions to flow through to the client (although I believe this should be a config option). But the part that I am troubled by is why my dev environment differs from production. This does not give me confidence that there aren't other land mines in my codebase! As developers, we expect our local environment to mimic production as closely as possible when possible. Local development in this instance should show the same exception that production does. Much of this problem goes away because teams handle server-side errors differently from the start. |
Beta Was this translation helpful? Give feedback.
-
|
This is such trash tier logic. Such a pain in the ass trying to diagnose my errors now in Cloudflare workers. Makes it near impossible to get reliable error messages without workarounds. What a flop. |
Beta Was this translation helpful? Give feedback.
-
|
Man I've had to update FIFTY!!! FIVE-ZERO Server Actions because of this!!! I lost confidence on my codebase :( |
Beta Was this translation helpful? Give feedback.
-
|
anybody find the fix? i have the same issue, and none of the solutions here worked for me so far |
Beta Was this translation helpful? Give feedback.
-
|
I strongly agree with what @tansut and @kelvanb97 have to say. 50 server actions to update? must be nice haha I've got 294 to do 😭 |
Beta Was this translation helpful? Give feedback.
-
|
My digest was: TL;DR
It did NOT help that my build pipeline was succeeding but the environment was technically invalid and Dokploy was silently falling back to my most recent successful deployment. I wish it had been louder about that, but falling back is the desired behavior. Additional ContextBecause I didn't realize my VPS wasn't serving my most recent code, I ended up making plenty of changes without really knowing where I could have stopped and it would have started working. Based on reviewing the doc, my best guess is that disabling pre-rendering was the main fix. I had no clue where or how the Async Context was being used improperly. Changes I made
Changes to the page giving 500 errorI'm not as familiar with Next.js, so I tasked an LLM with searching for issues. That resulted in changes to the - 'use server';
+ export const dynamic = 'force-dynamic';
- export const generateMetadata = async () { ... };
- export async function generateStaticParams() { ... }
const Item = async () { ... };
export default Item;So, just telling it to stop doing anything other than render the page. Deeper issues when transitioning more data to be asyncA part of my project was to transition off environments variables for the nodemailer settings, and transition to dynamic ones that could be controlled in an admin panel. |
Beta Was this translation helpful? Give feedback.






I have gotten a solution to it. So, the issue comes from the error logging to the terminal. In production nextjs try to protect the app from releasing sensitive information to client because it cannot tell if the error is internal or external.
For example:
If the error is coming from a third-party service, you are using it might contain sensitive info like api-key, user ids, etc.
So, the solution was to find a different method to log the error to the user.
"client side code (login page function)"
"Server side code (Action)"