Google 云构建步骤中的 Firebase CLI 错误
Firebase CLI error in Google Cloud Build step
当我在 cloudbuild 步骤中从 Firebase CLI 运行 宁 "firebase use" 命令时,我收到以下错误:
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
当我 运行 在我的本地计算机上使用完全相同的 Firebase CLI 版本和节点版本执行相同的命令时,我没有收到此错误。为什么会出现此错误以及如何解决?
现在似乎已修复(请参阅带有链接的原始问题的评论),但一般来说,解决此类问题的逻辑是尝试重建云构建步骤中使用的 firebase docker 图像。
当我在 cloudbuild 步骤中从 Firebase CLI 运行 宁 "firebase use" 命令时,我收到以下错误:
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
当我 运行 在我的本地计算机上使用完全相同的 Firebase CLI 版本和节点版本执行相同的命令时,我没有收到此错误。为什么会出现此错误以及如何解决?
现在似乎已修复(请参阅带有链接的原始问题的评论),但一般来说,解决此类问题的逻辑是尝试重建云构建步骤中使用的 firebase docker 图像。