firebase-tools: Unable to deploy Firebase app using service account default credentials

[REQUIRED] Environment info

firebase-tools: 7.13.0

Platform: Ubuntu on Cloudbuild from cloud-builders-community

[REQUIRED] Test case

  • Create any Firebase app
  • Attempt to deploy, using cloudbuld with a service account
  • Note that even if the service account is assigned the Owner role, this still fails.

[REQUIRED] Steps to reproduce

  • Attempt to deploy by running firebase deploy

[REQUIRED] Expected behavior

succesfully deployed.

[REQUIRED] Actual behavior

Starting Step #4 - "Deploy to Firebase Hosting"
Step #4 - "Deploy to Firebase Hosting": Pulling image: gcr.io/mike-242702/firebase
Step #4 - "Deploy to Firebase Hosting": Using default tag: latest
Step #4 - "Deploy to Firebase Hosting": latest: Pulling from mike-242702/firebase
Step #4 - "Deploy to Firebase Hosting": 3192219afd04: Already exists
Step #4 - "Deploy to Firebase Hosting": 17c160265e75: Already exists
Step #4 - "Deploy to Firebase Hosting": cc4fe40d0e61: Already exists
Step #4 - "Deploy to Firebase Hosting": 9d647f502a07: Already exists
Step #4 - "Deploy to Firebase Hosting": c8bd59397b26: Already exists
Step #4 - "Deploy to Firebase Hosting": f9289dfd19be: Already exists
Step #4 - "Deploy to Firebase Hosting": 9553b08b6292: Pulling fs layer
Step #4 - "Deploy to Firebase Hosting": 37581b1ce15a: Pulling fs layer
Step #4 - "Deploy to Firebase Hosting": 45ea08f1ad05: Pulling fs layer
Step #4 - "Deploy to Firebase Hosting": 134f3de54272: Pulling fs layer
Step #4 - "Deploy to Firebase Hosting": 2d088f82ff68: Pulling fs layer
Step #4 - "Deploy to Firebase Hosting": 134f3de54272: Waiting
Step #4 - "Deploy to Firebase Hosting": 2d088f82ff68: Waiting
Step #4 - "Deploy to Firebase Hosting": 45ea08f1ad05: Verifying Checksum
Step #4 - "Deploy to Firebase Hosting": 45ea08f1ad05: Download complete
Step #4 - "Deploy to Firebase Hosting": 37581b1ce15a: Verifying Checksum
Step #4 - "Deploy to Firebase Hosting": 37581b1ce15a: Download complete
Step #4 - "Deploy to Firebase Hosting": 2d088f82ff68: Verifying Checksum
Step #4 - "Deploy to Firebase Hosting": 2d088f82ff68: Download complete
Step #4 - "Deploy to Firebase Hosting": 134f3de54272: Verifying Checksum
Step #4 - "Deploy to Firebase Hosting": 134f3de54272: Download complete
Step #4 - "Deploy to Firebase Hosting": 9553b08b6292: Verifying Checksum
Step #4 - "Deploy to Firebase Hosting": 9553b08b6292: Download complete
Step #4 - "Deploy to Firebase Hosting": 9553b08b6292: Pull complete
Step #4 - "Deploy to Firebase Hosting": 37581b1ce15a: Pull complete
Step #4 - "Deploy to Firebase Hosting": 45ea08f1ad05: Pull complete
Step #4 - "Deploy to Firebase Hosting": 134f3de54272: Pull complete
Step #4 - "Deploy to Firebase Hosting": 2d088f82ff68: Pull complete
Step #4 - "Deploy to Firebase Hosting": Digest: sha256:d7764e447534464a4ae049f7fa64f55ec4433a93e4a097003ab20e1b922b3d19
Step #4 - "Deploy to Firebase Hosting": Status: Downloaded newer image for gcr.io/mike-242702/firebase:latest
Step #4 - "Deploy to Firebase Hosting": gcr.io/mike-242702/firebase:latest
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.389Z] ----------------------------------------------------------------------
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.392Z] Command:       /usr/local/bin/node /usr/local/bin/firebase deploy --project develop --debug
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.393Z] CLI Version:   7.7.0
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.393Z] Platform:      linux
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.393Z] Node Version:  v13.8.0
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.408Z] Time:          Fri Feb 14 2020 03:27:36 GMT+0000 (Coordinated Universal Time)
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.408Z] ----------------------------------------------------------------------
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.409Z] 
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.418Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.419Z] > attempting to authenticate via app default credentials
Step #4 - "Deploy to Firebase Hosting": [2020-02-14T03:27:36.525Z] TypeError: Cannot create property 'refresh_token' on string 'Not Found
Step #4 - "Deploy to Firebase Hosting": '
Step #4 - "Deploy to Firebase Hosting":     at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auth-library/lib/auth/oauth2client.js:208:28
Step #4 - "Deploy to Firebase Hosting":     at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auth-library/lib/auth/computeclient.js:85:7
Step #4 - "Deploy to Firebase Hosting":     at Request._callback (/usr/local/lib/node_modules/firebase-tools/node_modules/google-auth-library/lib/transporters.js:106:7)
Step #4 - "Deploy to Firebase Hosting":     at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
Step #4 - "Deploy to Firebase Hosting":     at Request.emit (events.js:321:20)
Step #4 - "Deploy to Firebase Hosting":     at Request.EventEmitter.emit (domain.js:485:12)
Step #4 - "Deploy to Firebase Hosting":     at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1154:10)
Step #4 - "Deploy to Firebase Hosting":     at Request.emit (events.js:321:20)
Step #4 - "Deploy to Firebase Hosting":     at Request.EventEmitter.emit (domain.js:485:12)
Step #4 - "Deploy to Firebase Hosting":     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1076:12)
Step #4 - "Deploy to Firebase Hosting": 
Step #4 - "Deploy to Firebase Hosting": Error: An unexpected error has occurred.
Finished Step #4 - "Deploy to Firebase Hosting"
ERROR
ERROR: build step 4 "gcr.io/mike-242702/firebase" failed: step exited with non-zero status: 2

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 14
  • Comments: 19 (13 by maintainers)

Most upvoted comments

The fix for this bug has been released in version 7.13.1

Thanks for the update. I am already very impressed with the very quick response times. I understand that releasing a new version on a friday as a “one man job” is not the best idea in the world. I’ll use the workaround for now and will check early next week for a new release

Thanks again!

We are suffering from this same issue (unable to use firebase-tools cli on google cloud build). I am still investigating but could this be causes by the deprecation of the GCP metadata endpoints? https://cloud.google.com/compute/docs/migrating-to-v1-metadata-server#supported-google-libraries

This requires GCP auth related libraries to be updated and the version of google-auto-auth that is used by firebase-tools is very old which also means it is using a very old version of gcp-metadata and gcp-auth-library:

$ npm ls gcp-metadata
├─┬ firebase-tools@7.13.0
│ └─┬ google-auto-auth@0.7.2
│   └── gcp-metadata@0.3.1
└─┬ googleapis@46.0.0
  └─┬ google-auth-library@5.8.0
    └── gcp-metadata@3.3.0
$ npm ls google-auth-library
├─┬ firebase-admin@8.9.0
│ ├─┬ @google-cloud/firestore@3.3.3
│ │ └─┬ google-gax@1.13.0
│ │   └── google-auth-library@5.8.0  deduped
│ └─┬ @google-cloud/storage@4.2.0
│   ├─┬ @google-cloud/common@2.2.5
│   │ └── google-auth-library@5.8.0  deduped
│   └─┬ gcs-resumable-upload@2.3.2
│     └── google-auth-library@5.8.0  deduped
├─┬ firebase-tools@7.13.0
│ ├─┬ @google-cloud/pubsub@1.5.0
│ │ └── google-auth-library@5.8.0  deduped
│ ├─┬ google-auto-auth@0.7.2
│ │ └── google-auth-library@0.10.0
│ └─┬ google-gax@1.12.0
│   └── google-auth-library@5.8.0  deduped
└─┬ googleapis@46.0.0
  ├── google-auth-library@5.8.0
  └─┬ googleapis-common@3.2.1
    └── google-auth-library@5.8.0  deduped

The page about the metadata server deprecation lists a number of nodejs libraries that need updating. It seems like at least gcp-metadata and google-auth-library that firebase-tools uses are too old

Same thing happening today on a Cloud Build environment with the correct IAM roles to deploy to Firebase Hosting.

@rajivsubra1981 Had the same issue, solved by rebuilding docker image for firebase community builder from here https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/firebase, just follow the instruction in the root project readme. Once it was uploaded I also deleted the old image and everything worked fine. ,

We had the same issue with our deployments and it is resolved by using branch mentioned 👍 A bit funny this “update” that made the old library not working anymore happened on Valentine’s Day… where was the love? 😄 ❤️