0

=== Deploying to 'project_id'...

Step #1:

Step #1: I deploy functions

Step #1:

Step #1: Error: Failed to get Firebase project 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.

This is my cloudbuild.yaml steps:

#Install
- name: 'gcr.io/cloud-builders/npm'
  args: ['install']
  
#Deploy
- name: 'gcr.io/flysample-75b81/firebase'
  args: ['deploy']

And this is my 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.

2
  • Have you already check this documentation? You're missing some flags on the args. Let me know if it helps. Commented Sep 7, 2022 at 5:56
  • Will you please let me know the sample cloudbuild file. As I have tried so many options and none work for me Commented Sep 7, 2022 at 10:50

1 Answer 1

0

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

You should specify your Firebase Project ID in the .yaml or .json file. See sample below:

steps:
- name: gcr.io/project-id/firebase
  args: ['deploy', '--project=firebase-project-id', '--only=hosting']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.