Next.js getStaticPaths报错Call retries were exceeded,降级至12版本仍未解决
问题
访问动态slug页面时触发「Call retries were exceeded」错误,参考相关讨论将项目从Next.js 13降级至12.2.2版本后,问题仍未解决。
错误截图

相关代码
slug.js
export const getStaticPaths = async () => { const res = await axios(process.env.NEXT_PUBLIC_API_URL+'/products'); const products_arr = await res.data; const paths = products_arr.map( (pr) => ({ params: { slug: pr.slug } })) return { paths, fallback: "blocking", }; } export const getStaticProps = async ({params}) => { try { const res = await axios(`${process.env.NEXT_PUBLIC_API_URL}/products/${params.slug}`); const product = await res.data; return { props: { product } } } catch (error) { console.error(error); return { notFound: true }; } }
package.json
{ "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "postinstall": "patch-package" }, "dependencies": { "@tailwindcss/typography": "^0.5.9", "axios": "^1.3.4", "flowbite": "^1.6.3", "flowbite-react": "^0.4.1", "next": "12.2.2", "next-themes": "^0.2.1", "patch-package": "^7.0.0", "pure-react-carousel": "^1.30.1", "react": "18.2.0", "react-dom": "18.2.0", "react-icons": "^4.7.1", "swiper": "^8.4.5", "swr": "^2.1.0" }, "devDependencies": { "@types/node": "20.2.5", "@types/react": "18.2.7", "autoprefixer": "^10.4.12", "postcss": "^8.4.18", "tailwindcss": "^3.2.4", "typescript": "4.9.4" } }
内容的提问来源于stack exchange,提问作者shazim ali
相关产品推荐
相关产品推荐

