【问题标题】:Vercel Deployment Error: @notionhq/client warn: request fail { code: 'unauthorized', message: 'API token is invalid.' }Vercel 部署错误:@notionhq/client 警告:请求失败 { 代码:\'unauthorized\',消息:\'API 令牌无效。\'}
【发布时间】:2022-08-20 02:20:52
【问题描述】:

当我在 vercel.com 中部署项目时,出现此错误:

问题的关键是\"request fail { code: \'unauthorized\', message: \'API token is invalid.\' }\",导致部署不成功

Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js\' roadmap and prioritize features.
You can learn more, including how to opt-out if you\'d not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
info  - Checking validity of types...
info  - Creating an optimized production build...
info  - Compiled successfully
info  - Collecting page data...
@notionhq/client warn: request fail { code: \'unauthorized\', message: \'API token is invalid.\' }
> Build error occurred
Error [APIResponseError]: API token is invalid.
    at buildRequestError (/vercel/path0/node_modules/.pnpm/@notionhq+client@1.0.4/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/vercel/path0/node_modules/.pnpm/@notionhq+client@1.0.4/node_modules/@notionhq/client/build/src/Client.js:304:54)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getDatabase (/vercel/path0/.next/server/chunks/312.js:49:22)
    at async getStaticPaths (/vercel/path0/.next/server/pages/blog/[slug].js:880:16)
    at async buildStaticPaths (/vercel/path0/node_modules/.pnpm/next@12.1.6_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/next/dist/build/utils.js:491:31)
    at async /vercel/path0/node_modules/.pnpm/next@12.1.6_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/next/dist/build/utils.js:632:119
    at async Span.traceAsyncFn (/vercel/path0/node_modules/.pnpm/next@12.1.6_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/next/dist/trace/trace.js:79:20) {
  type: \'APIResponseError\',
  code: \'unauthorized\',
  status: 401,
  headers: {},
  body: \'{\"object\":\"error\",\"status\":401,\"code\":\"unauthorized\",\"message\":\"API token is invalid.\"}\'
}
 ELIFECYCLE  Command failed with exit code 1.
Error! Command \"pnpm run build\" exited with 1

    标签: vercel


    【解决方案1】:

    感谢您的提问!好像你没有通过 vercel 的仪表板设置你的环境变量

    【讨论】:

      猜你喜欢
      • 2022-01-09
      • 2019-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-30
      • 2021-08-19
      相关资源
      最近更新 更多