You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何关闭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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 08:27:36