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

Vercel部署Next.js+Supabase遇DynamicServerError,方案是否正确?

Next.js + Supabase部署问题排查

问题1:DynamicServerError解决方式的正确性验证

在Vercel部署Next.js + Supabase项目时触发DynamicServerError,甚至重新部署之前能正常运行的版本也会报错。

几乎所有页面都通过以下逻辑做登录鉴权:

const supabase = createServerComponentClient({ cookies });

const {data: {session }} = await supabase.auth.getSession();

if(!session){
   redirect('/login')
}

查阅资料后,在layout.tsx中添加了如下配置:

export const revalidate = 0;
export const dynamic = "force-dynamic";

添加后DynamicServerError消失,但看到部分技术帖提到该方案的有效性依赖场景,想确认这个配置是否适配我的鉴权场景。


问题2:新增的构建失败错误

解决DynamicServerError后,部署又出现新问题:

  • Vercel部署时提示:Build failed because of webpack errors
  • 本地执行npm run build时出现字体请求超时错误,完整报错如下:
FetchError: request to https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7W0Q5n-wU.woff2 failed, reason: connect ETIMEDOUT 2404:6800:4017:801::2003:443
    at ClientRequest.<anonymous> (C:file here\node_modules\next\dist\compiled\node-fetch\index.js:1:65756)
    at ClientRequest.emit (node:events:517:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
FetchError: request to https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7W0Q5n-wU.woff2 failed, reason: connect ETIMEDOUT 2404:6800:4017:801::2003:443
    at ClientRequest.<anonymous> (C:file here\node_modules\next\dist\compiled\node-fetch\index.js:1:65756)
    at ClientRequest.emit (node:events:517:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
FetchError: request to https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7W0Q5n-wU.woff2 failed, reason: connect ETIMEDOUT 2404:6800:4017:801::2003:443
    at ClientRequest.<anonymous> (Cfile here\node_modules\next\dist\compiled\node-fetch\index.js:1:65756)
    at ClientRequest.emit (node:events:517:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
Failed to compile.

app\layout.tsx
`next/font` error:
Failed to fetch `Inter` from Google Fonts.

> Build failed because of webpack errors
   Creating an optimized production build  .

疑问:是否与Supabase故障相关?

当前Supabase状态页面显示Auth服务存在部分故障,想确认这是否会引发上述部署/构建问题。


内容的提问来源于stack exchange,提问作者JS3

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 09:06:00