首页 > 解决方案 > Google Cloud Build 错误没有项目处于活动状态

问题描述

我正在尝试使用托管在 firebase 上的一个非常简单的项目来设置 Google Cloud Build,但每次它到达部署阶段时它都会告诉我:

Error: No project active, but project aliases are available.

Step #2: Run firebase use <alias> with one of these options:

ERROR: build step 2 "gcr.io/host-test-xxxxx/firebase" failed: step exited with non-zero status: 1

我已将别名设置为生产,我的 .firebasesrc 是:

{
  "projects": {
    "default": "host-test-xxxxx",
    "production": "host-test-xxxxx"
  }

我对我的云构建器服务具有 firebase 管理员和 API 密钥管理员权限,并且我也想加密,所以我有 Cloud KMS CryptoKey Decrypter

我愿意

firebase login:ci

在我的终端中生成一个令牌并将其粘贴到我的 .env 变量中,然后生成一个名为 production 的别名并执行

firebase use production

我的yaml是:

steps:
# Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['install']
# Build
- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'build']
# Deploy
- name: 'gcr.io/host-test-xxxxx/firebase'
  args: ['deploy']

并安装和构建工作正常。这里发生了什么?

重新运行 firebase init 似乎没有帮助。

更新:

在本地构建然后进行 firebase deploy 也无济于事。

标签: google-cloud-platformfirebase-hostinggoogle-cloud-build

解决方案


好的,将 .firebasesrc 文件更改为:

{
  "projects": {
    "default": "host-test-xxxxx"
  }
}

firebase use --add

并添加一个名为 default 的别名。


推荐阅读