Repository navigation
How to fix or disable this error in production mode "An error occurred in the Server Components render..." #71099
Replies: 14 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? |
|
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)" |
|
did you solve it ?? |
|
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. |
|
I created an issue. |
|
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:
***@***.***>
|
|
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. |
|
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. |
|
Man I've had to update FIFTY!!! FIVE-ZERO Server Actions because of this!!! I lost confidence on my codebase :( |
|
anybody find the fix? i have the same issue, and none of the solutions here worked for me so far |
|
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 😭 |
|
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. |
|
The database blockage was caused by Namecheap's server being unable to establish a direct TCP connection to your Neon PostgreSQL database on port 5432. It was not caused by an incorrect database password or a missing database.
Your application was using Prisma's traditional PostgreSQL connection. Our tests showed:
We changed the connection method to use Neon's serverless WebSocket connection instead of the traditional TCP connection. However, the first implementation had a module import issue: The default import was not being handled correctly during Next.js Webpack compilation. We corrected it to: After that, the production build succeeded. Prisma → PostgreSQL TCP → Neon port 5432 New connection Prisma → Neon Serverless Adapter → WebSocket → Neon Verified result Production build: Successful. My recommendation The next important step is to restart the cPanel application and test the live website, including login, deposits, withdrawals and dashboard data. One distinction: we have verified database connectivity and a successful build, but we have not yet verified every database operation through the live website. |






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)"