[英]deploy cloud functions using cloud build failed: Error: failed to get firebase project
=== Deploying to 'project_id'... === 部署到“project_id”...
Step #1:步骤1:
Step #1: I deploy functions第 1 步:我部署功能
Step #1:步骤1:
Step #1: Error: Failed to get Firebase project project_id.第 1 步:错误:无法获取 Firebase 项目 project_id。 Please ensure the project exists and that your account has permission to access it.请确保该项目存在并且您的帐户有权访问它。
This is the error I am getting when I try to deploy my cloud function using cloud build.这是我尝试使用云构建部署我的云 function 时遇到的错误。
This is my cloudbuild.yaml
steps:这是我的cloudbuild.yaml
步骤:
#Install
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
#Deploy
- name: 'gcr.io/flysample-75b81/firebase'
args: ['deploy']
And this is my package.json这是我的 package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "index.js",
"dependencies": {
"body-parser": "^1.20.0",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.0"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0"
},
"private": true
}
If anyone has an idea, Let me know how to solve this error.如果有人有想法,请告诉我如何解决此错误。
As stated in the documentation ,如文档中所述,
Create a build config file named cloudbuild.yaml or cloudbuild.json where project-id is your Cloud project ID and firebase-project-id is your Firebase project ID创建一个名为 cloudbuild.yaml 或 cloudbuild.json 的构建配置文件,其中 project-id 是您的 Cloud 项目 ID,firebase-project-id 是您的 Firebase 项目
You should specify your Firebase Project ID in the .yaml
or .json
file.您应该在.yaml
或.json
文件中指定您的 Firebase 项目 ID。 See sample below:请参阅下面的示例:
steps:
- name: gcr.io/project-id/firebase
args: ['deploy', '--project=firebase-project-id', '--only=hosting']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.