在firebase主机中部署nextjs时出错-为cpu指定的值无效

qvtsj1bj  于 2023-03-29  发布在  其他
关注(0)|答案(1)|浏览(136)

我得到的错误,而部署nextjs 13在firebase托管通过firebase-tools。
错误-HTTP Error: 400, Could not create Cloud Run service ssrlyeanabot. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 30.\nConsider running your workload in a region with greater capacity, decreasing your requested cpu-per-instance, or requesting an increase in quota for this region if you are seeing sustained usage near this limit, see https://cloud.google.com/run/quotas. Your project may gain access to further scaling by adding billing information to your account."

Error: Failed to create function ssrlyeanabot in region us-central1

package.json

{
  "name": "testing",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "eslint": "8.36.0",
    "eslint-config-next": "13.2.4",
    "next": "13.2.4",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

firebase.json

{
  "hosting": {
    "source": ".",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "frameworksBackend": {
      "region": "us-central1"
    }
  }
}

Firebase工具版本-11.25.1

重现此问题的步骤

  1. npx创建下一个应用程序@最新
  2. firebase实验:启用webframeworks
  3. Firebase初始化托管
  4. firebase deploy [done] IMP -〉enable billing.
    请告诉我,我该怎么办。
56lgkhnf

56lgkhnf1#

将密钥maxInstances: <some number less 30>添加到firebase.json文件的frameworksBackend部分

{
  "hosting": {
    "source": ".",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "frameworksBackend": {
      "region": "us-central1",
      "maxInstances": 2
    }
  }
}

说明:
当Firebase CLI尝试创建云函数以支持Nextjs Framework时,部署失败。
使用firebase --debug deploy,CLI似乎没有传递maxInstance参数来创建云函数,这导致错误。
设置maxInstances指定此函数所需的最大示例数(应小于项目配额- 30)
firebase.json的架构

相关问题