无法从GCP Cloud Build部署到Firebase托管
我在一个GCP项目中有一个存储库,其中包含要在Firebase中作为托管应用发布的PWA.我想设置一个触发器,以便每当在分支中执行一次推送时,它就会在Firebase中部署de PWA.我已按照GCP文档部署Firebase 中的步骤进行操作,但我总是收到似乎是授权错误的内容
I have a repo in a GCP project that containes a PWA that I want to publish in Firebase as a hosting app. I want to setup a trigger so whenever a push is done in a branch it deploys de PWA in Firebase. I've followed the steps in GCP documentation Deploy Firebase but I'm always getting what it seems an authorization error
无法获取Firebase项目ghe-dev-repositories-170-920df.请确保该项目存在,并且您的帐户有权访问该项目.
Failed to get Firebase project ghe-dev-repositories-170-920df. Please make sure the project exists and your account has permission to access it.
我已经多次检查是否已启用所有必需的API,并且@ cloudbuild.gserviceaccount.com帐户具有必需的角色.
I have checked several times that all required APIs are enabled and that @cloudbuild.gserviceaccount.com account has the required roles.
我注意到,在创建Firebase项目时,Firebase为该项目提供了一个与GCP项目不同的ID.下面我粘贴cloudbuild.yaml
I have noticed that when creating the Firebase project, Firebase gave the project an Id distinct than the GCP project. Below I'm pasting the cloudbuild.yaml
steps:
- name: node
entrypoint: yarn
args: ["install"]
- name: gcr.io/cloud-builders/gsutil
args: ['cp', '${_APP_ENV_PATH}', 'packages/app/.env']
- name: node
entrypoint: yarn
args: ["build"]
- name: 'gcr.io/${_GCP_PROJECT_ID}/firebase'
args: ['deploy', '--project=${_TARGET_PROJECT_ID}', '--only=hosting:${_TARGET_ENVIRONMENT}']
timeout: "1600s"
有任何线索吗?
您是否运行过 firebase login:ci
并设置了环境变量 FIREBASE_TOKEN
?
Did you run firebase login:ci
and set the environment variable FIREBASE_TOKEN
?
请参阅: