1

このエラーが発生しています

Error: Error serializing `.remarkBody` returned from `getStaticProps` in "/blog/[slug]".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.

これを実行しようとすると:

const body = blogPostCollection ? blogPostCollection?.items[0]?.body : ''

  const remarkBody = remark().use(strip).process(body, (err, file) => {
    if (err) throw err
    String(file)
  })

  return {
    props: {
      remarkBody: remarkBody,
    },
    revalidate: 1
  }

誰かがこれで私を助けることができますか?

4

2 に答える 2