如何关闭Vercel生产环境中Server Actions的错误混淆?
如何关闭Vercel上Next.js Server Actions的错误信息自动混淆?
问题背景
本地开发时错误信息显示正常,但部署到Vercel生产环境后,Next.js会自动捕获并混淆后端运行时错误。尝试设置环境变量NEXT_PUBLIC_DEBUG_ERRORS=true,但无任何效果。
复现用Server Actions代码
'use server'; export async function throwRegularError() { throw new Error('this is a regular error: "dd-trace-8278-cab9522e6e28"'); }
Vercel生产环境返回的混淆错误信息
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." ] }
额外问题说明
错误提示存在表述错误:实际是Server Actions调用过程中出错,但提示文本显示为“An error occurred in the Server Components render”(Server Components渲染出错),与实际场景不符。
核心需求
寻求能够关闭Next.js在Vercel生产环境中自动混淆错误信息的方法。
内容的提问来源于stack exchange,提问作者Alexander Mills
相关产品推荐
相关产品推荐

