Locally everything is fine, when deployed to Vercel, backend runtime errors are trapped by Vercel/Next.js and they are automatically obfuscated, which is nice, but I want to turn it off.
unfortunately it seems that setting the following env var didn't change anything:
NEXT_PUBLIC_DEBUG_ERRORS=true
to reproduce this problem:
server action throws error, for example:
'use server';
export async function throwRegularError() {
throw new Error('this is a regular error: "dd-trace-8278-cab9522e6e28"');
}
in production (on Vercel at least), the client will see this:
Caught error from 'throwRegularError': {
"name": "Error",
"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.",
"stack": [
"Error: 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."
]
}
As a side-note, technically this is wrong
An error occurred in the Server Components render
it should read this instead:
An error occurred in a Server Actions call