【问题标题】:Server Error Error: Configuration must contain projectId‘服务器错误错误:配置必须包含 projectId‘
【发布时间】:2022-03-20 23:52:30
【问题描述】:

我遵循了这个教程:https://youtu.be/mx1dbMzd3tU

当我尝试连接 sanity 时,接下来会出现此错误

服务器错误 错误:配置必须包含 projectId'

【问题讨论】:

标签: next.js sanity


【解决方案1】:

当您缺少 projectId 时会出现此错误。创建 Sanity 客户端实例时,您必须使用 projectId:

const client = sanityClient({
  projectId: 'yourproject-id',
  dataset: 'your dataset',
  token: 'Sanity build token',
  apiVersion: 'v1',
  useCdn: false // `false` if you want to ensure fresh data
})

【讨论】:

    猜你喜欢
    • 2023-02-05
    • 2022-06-13
    • 2022-09-29
    • 2019-08-26
    • 2021-08-31
    • 2021-01-30
    • 1970-01-01
    • 2018-01-14
    • 1970-01-01
    相关资源
    最近更新 更多