Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 13: Wrong information about server action error handling #957

Closed
aabuhijleh opened this issue Dec 20, 2024 · 1 comment
Closed

Comments

@aabuhijleh
Copy link

aabuhijleh commented Dec 20, 2024

This chapter suggests that uncaught server action exceptions can be caught using an error.tsx error boundary component. However, based on my experience, this behavior only works in development mode.

In production, it seems to behave differently. Instead of rendering the content from my error boundary, I’m seeing this generic message:

Application error: a server-side exception has occurred (see the server logs for more information).

image

This raises several questions:

  • Is this the expected behavior in production?
  • If so, how are developers supposed to handle uncaught exceptions effectively?

Should we be wrapping server actions in try/catch blocks and manually sending errors to the client for handling? Or is there a recommended approach that I might be missing?

Next.js version: 15

@leerob
Copy link
Member

leerob commented Jan 15, 2025

Thank you, I will make this more clear

Docs: https://nextjs.org/docs/app/getting-started/error-handling

@leerob leerob closed this as completed Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants