When I am running the "firebase use" command from the Firebase CLI in a cloudbuild step I get the following error:
Starting Step #5 - "SetFirebaseEnvironment"
Step #5 - "SetFirebaseEnvironment": Already have image (with digest): eu.gcr.io/BUCKET_NAME/firebase:7.12-0
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.806Z] ----------------------------------------------------------------------
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Command: /usr/local/bin/node /usr/local/bin/firebase use dev --debug
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] CLI Version: 7.12.1
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Platform: linux
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Node Version: v13.6.0
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z] Time: Mon Feb 17 2020 13:09:50 GMT+0000 (Coordinated Universal Time)
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z] ----------------------------------------------------------------------
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z]
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.820Z] > 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 #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.820Z] > attempting to authenticate via app default credentials
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.854Z] TypeError: Cannot create property 'refresh_token' on string 'Not Found
Step #5 - "SetFirebaseEnvironment": '
Step #5 - "SetFirebaseEnvironment": at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/oauth2client.js:208:28
Step #5 - "SetFirebaseEnvironment": at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/computeclient.js:85:7
Step #5 - "SetFirebaseEnvironment": at Request._callback (/usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/transporters.js:106:7)
Step #5 - "SetFirebaseEnvironment": at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
Step #5 - "SetFirebaseEnvironment": at Request.emit (events.js:321:20)
Step #5 - "SetFirebaseEnvironment": at Request.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1154:10)
Step #5 - "SetFirebaseEnvironment": at Request.emit (events.js:321:20)
Step #5 - "SetFirebaseEnvironment": at Request.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1076:12)
Step #5 - "SetFirebaseEnvironment": at Object.onceWrapper (events.js:427:28)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.emit (events.js:333:22)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at endReadableNT (_stream_readable.js:1220:12)
Step #5 - "SetFirebaseEnvironment": at processTicksAndRejections (internal/process/task_queues.js:84:21)
Step #5 - "SetFirebaseEnvironment":
Step #5 - "SetFirebaseEnvironment": Error: An unexpected error has occurred.
Finished Step #5 - "SetFirebaseEnvironment"
2020/02/17 14:09:51 Step Step #5 - "SetFirebaseEnvironment" finished
2020/02/17 14:09:51 status changed to "ERROR"
ERROR
ERROR: build step 5 "eu.gcr.io/BUCKET_NAME/firebase:7.12-0" failed: exit status 2
2020/02/17 14:09:54 Build finished with ERROR status
When I run the same command on my local machine with exactly the same Firebase CLI version and Node version I dont get this error. Why do I get this error and how do a solve it?
It seems as it's fixed now (see comments to original question with links), but generally, the logic to fix such an issue is to try rebuilding firebase docker image used in cloud builder step.