vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.78k stars 26.95k forks source link

Docs: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions #50485

Open viczam opened 1 year ago

viczam commented 1 year ago

What is the improvement or update you wish to see?

When throwing an error in a server action we get back the right message in a client component while we're in development mode, but in production the error message is hidden behind this message: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.

The documentation on how to handle validation in server actions is misleading because of this: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#validation

It should state that we should return an error message instead of throwing an error.

Is there any context that might help us understand?

https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#validation

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#validation

DX-1649

mrhaddad commented 5 months ago

Any fixes? Can we just disable this behavior?