我正在开发一个新项目,最近在我的前端应用程序中使用了 nextjs13。
\n当函数generateStaticParams与next/header库函数headers()一起使用时,
\n我在开发模式下遇到错误。
\n\n\n\n未处理的运行时错误 - 动态服务器使用:标头
\n
但是当前端使用下一个构建/下一个启动时,不会出现错误。
\n我使用 next/header 库的主要原因是为了获得对 cookie 的访问权限。
\ngenerateStaticParams在app/detail/[questionId]/page.tsx文件中\next/headers 在app/layout.tsx文件中
import React from "react";\nimport QuestionCard from "../components/Card/QuestionCard";\nimport Carousel from "../components/Carousel/Carousel";\nimport HomeNavBar from "../components/HomeNavBar/HomeNavBar";\nimport { ICarousel } from "../types/carousel";\nimport TabNavigator from "../components/TabNavigator/TabNavigator";\n\nconst getGoogleSession = async () => {};\n\nconst getQuestionList = async () => {\n const response = await fetch(`https://pioneroroom.com/questionlist`);\n const data = await response.json();\n return data;\n};\n\nconst page = …Run Code Online (Sandbox Code Playgroud)