预渲染页面发生错误“/page/[...uri].js

Error occurred prerendering page "/page/[...uri].js

伙计们,当我在我的 nextjs 中尝试 运行“npm 运行 build”时遇到了奇怪的错误,

我的文件在

pages/agenda/[...uri].tsx

运行问题的部分代码

export async function getStaticProps({ params }: { params: any }) {
  const tournamentData = await getTournamentData(params.uri[0])
  return {
    props: {
      tournamentData
    }
  }
}

export async function getStaticPaths() {
  const paths = await getAllTournamentIds()
  return {
    paths,
    fallback: false
  }
}

错误:

info  - Collecting page data  
[    ] info  - Generating static pages (0/14)
Error occurred prerendering page "/noticia/[object Object]/1". Read more: https://nextjs.org/docs/messages/prerender-error
FetchError: invalid json response body at https://api.torneio.app/v1/news?id=[object%20Object] reason: Unexpected token < in JSON at position 0
    at /Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/node_modules/next/dist/compiled/node-fetch/index.js:1:49606
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getPostData (/Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/.next/server/chunks/776.js:82:19)
    at async getStaticProps (/Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/.next/server/pages/noticia/[...uri].js:254:22)
    at async renderToHTML (/Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/node_modules/next/dist/server/render.js:488:20)
    at async /Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/node_modules/next/dist/export/worker.js:253:36
    at async Span.traceAsyncFn (/Users/begomarcus/Workspace/projects/platform-beach-tennis/nextjs/node_modules/next/dist/trace/trace.js:79:20)

我真的不明白这里发生了什么,任何线索都会有很大帮助!

感谢@juliomalves 我检查了我的文件,我从 API 请求数据并发现我的地图有错误

以前是:

const postsData = data.map(({ id: string, slug: string }) => {
    return {
      params: {
        uri: [`${id}`, `${slug}`]
      }
    }
  })

所以我改成:

const postsData = data.map(({ id, slug }: { id: string, slug: string }) => {
    return {
      params: {
        uri: [`${id}`, `${slug}`]
      }
    }
  })

打字稿输入和正确参数的小错误。