nextjs
build_error
ai_generated
partial
Error: Static generation timed out after 60 seconds for path '/[slug]'. Consider increasing the static generation timeout.
ID: nextjs/static-generation-timeout-slug
75%Fix Rate
83%Confidence
1Evidence
2023-08-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Next.js 13.3+ | active | — | — | — |
| Next.js 14.0 | active | — | — | — |
| Next.js 15.0 | active | — | — | — |
Root Cause
During static generation (e.g., with `output: export` or `generateStaticParams`), a page takes longer than the default 60-second timeout to render, often due to slow data fetching or heavy computation.
generic中文
在静态生成期间(例如,使用 `output: export` 或 `generateStaticParams`),页面渲染时间超过默认的 60 秒超时,通常由于数据获取缓慢或计算量大。
Official Documentation
https://nextjs.org/docs/messages/static-generation-timeoutWorkarounds
-
80% success Increase the timeout in next.config.js: `module.exports = { staticGenerationTimeout: 120 }`
Increase the timeout in next.config.js: `module.exports = { staticGenerationTimeout: 120 }` -
90% success Optimize data fetching in the page: use caching, limit the number of items in `generateStaticParams`, or use incremental static regeneration.
Optimize data fetching in the page: use caching, limit the number of items in `generateStaticParams`, or use incremental static regeneration.
中文步骤
Increase the timeout in next.config.js: `module.exports = { staticGenerationTimeout: 120 }`Optimize data fetching in the page: use caching, limit the number of items in `generateStaticParams`, or use incremental static regeneration.
Dead Ends
Common approaches that don't work:
-
70% fail
This prevents static generation entirely, but if the project requires static export (`output: export`), dynamic rendering is not allowed.
-
50% fail
It only masks the issue; if the underlying cause (slow data fetch) isn't fixed, builds become unreasonably long.
-
85% fail
Breaking change: without it, dynamic routes won't be pre-rendered for static export, causing build failures.