我试图运行 firebase deploy 但我得到:

=== Deploying to 'snag-b2b2d'...

i  deploying functions
i  functions: ensuring necessary APIs are enabled...
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (49.59 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: updating Node.js 6 function sendMessageNotification(us-central1)...
⚠  functions: failed to update function sendMessageNotification
HTTP Error: 503, The service is currently unavailable.


Functions deploy had errors. To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.

Having trouble? Try firebase deploy --help

仅供参考,这是在我的一个服务帐户遭到入侵后发生的,因为我意外地将服务帐户 json 文件(包含我的凭据)上传到github . 在我的帐户被暂停后,我完成了here描述的程序,并且我成功恢复了它 . 我删除并创建了所有必要的凭据(API密钥/服务帐户/ ouath客户端ID)后才开始出现此问题 .

我已尝试 firebase logout 然后 firebase login 并且部署失败 . 我也尝试了 npm install -g firebase-tools@latestfirebase use --add <myproject> (我不确定应该做什么) . 我甚至重新安装 firebase-tools 但是仍然没有帮助 .

我也尝试从 google cloud console 编辑 firebase 函数,但它不让我保存,它给了我一个 undefined 错误,以及问题的跟踪号,我提供了反馈,但没有听到任何消息 .

任何想法将不胜感激 .

UPDATE

这是我的凭据页面,我不确定是否所有内容都配置正确,希望可以从中获得一些信息,因为我认为项目被泄露并且必须更新密钥与 firebase deploy 问题有关:

enter image description here

UPDATE

我也试过没有运气重置 gcloud 凭证:

./gcloud auth application-default login

UPDATE

我跑了 firebase deploy --only functions --debug ,这里有更多输出:

i函数:更新Node.js 6函数sendMessageNotification(us-central1)... [2018-09-20T22:28:14.587Z]触发器为:{“eventTrigger”:{“resource”:“projects / snag-b2b2d /databases/(default)/documents/messages/","eventType":"providers/cloud.firestore/eventTypes/document.write","service":"firestore.googleapis.com“}} [2018- 09-20T22:28:14.588Z] >>> HTTP REQUEST PATCH https://cloudfunctions.googleapis.com/v1/projects/snag-b2b2d/locations/us-central1/functions/sendMessageNotification查询参数:{ “updateMask”: “sourceUploadUrl,名称,标签,eventTrigger.resource,eventTrigger.eventType,eventTrigger.service”} sourceUploadUrl = HTTPS://storage.googleapis.com/gcf-upload-us-central1-42327ef0-9b18-406c-9b7e-7b716bb814f8/ d84bdea4-ba16-4260-93c8-c46c2d4066f0.zip?GoogleAccessId=service-599782590095@gcf-admin-robot.iam.gserviceaccount.com&Expires=1537484293&Signature=WRnMwsiVxLWWPWgf6MEgB6ggvAu3Zbl1bpYtqOCr4p7Ry3JcvN%2B3Xa44WjNT2XD4sC%2FfQKcTC0UJCbX8t8F7YPnR2EO1nKM%2BPJTZyJBxYOMvJTFXiqaEe97FW TBU8BifcPGmyp%2FRMttlBIvC7CWoi8swBceMKKF3zjFbfvoy7jCBkAqvJHlvLeBb6GEb4Gg6CFMYA3eL9ue4TFksLvk1lUYUJrHX2Pv5P2ezRj8%2BYoUFoHrY7xammMy0USgPi23CzPWGGdL%2BMu2Iy2%2BZA4ZE8q0KRCLXXVTr8TQK0Qx2G9IM3mWogL5ViNwxDdX6Xl7iiAHwsyBdvQRn%2FfO6AEm7nQ%3D%3D,名称=项目/抽丝-b2b2d /位置/ US-central1 /功能/ sendMessageNotification,部署工具= CLI-火力,资源=项目/抽丝,b2b2d /数据库/(默认)/ documents / messages / ,eventType = providers / cloud.firestore / eventTypes / document.write,service = firestore.googleapis.com [2018-09-20T22:28:15.055Z] <<< HTTP RESPONSE 503 = X-Origin,Referer,Origin,Accept-Encoding,content-type = application / json; charset = UTF-8,date =星期四,2018年9月20日22:28:15 GMT,server = ESF,cache-control = private,x-xss-protection = 1; mode = block,x-frame-options = SAMEORIGIN,x-content-type-options = nosniff,alt-svc = quic =“:443”; MA = 2592000; v =“44,43,39,35”,accept-ranges = none,connection = close [2018-09-20T22:28:15.056Z] <<< HTTP RESPONSE BODY code = 503,message =该服务当前不可用 . ,status = UNAVAILABLE⚠函数:无法更新函数sendMessageNotification HTTP错误:503,该服务当前不可用

有趣的是,如果你点击https://cloudfunctions.googleapis.com/v1/projects/snag-b2b2d/locations/us-central1/functions/sendMessageNotification(从输出中),它会带你到这个:

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }
}

它说我缺少认证凭证......

UPDATE

当我单击上面输出中的 url 时,它会显示:

<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
<StringToSign>
GET 1537484293 /gcf-upload-us-central1-42327ef0-9b18-406c-9b7e-7b716bb814f8/d84bdea4-ba16-4260-93c8-c46c2d4066f0.zip
</StringToSign>
</Error>

UPDATE

来自谷歌的 OAuth 2.0 Playground

GET /gcf-upload-us-central1-42327ef0-9b18-406c-9b7e-7b716bb814f8/d84bdea4-ba16-4260-93c8-c46c2d4066f0.zip?GoogleAccessId=service-599782590095@gcf-admin-robot.iam.gserviceaccount.com&Expires=1537484293&Signature=WRnMwsiVxLWWPWgf6MEgB6ggvAu3Zbl1bpYtqOCr4p7Ry3JcvN%2B3Xa44WjNT2XD4sC%2FfQKcTC0UJCbX8t8F7YPnR2EO1nKM%2BPJTZyJBxYOMvJTFXiqaEe97FWTBU8BifcPGmyp%2FRMttlBIvC7CWoi8swBceMKKF3zjFbfvoy7jCBkAqvJHlvLeBb6GEb4Gg6CFMYA3eL9ue4TFksLvk1lUYUJrHX2Pv5P2ezRj8%2BYoUFoHrY7xammMy0USgPi23CzPWGGdL%2BMu2Iy2%2BZA4ZE8q0KRCLXXVTr8TQK0Qx2G9IM3mWogL5ViNwxDdX6Xl7iiAHwsyBdvQRn%2FfO6AEm7nQ%3D%3D HTTP/1.1
Host: storage.googleapis.com
Content-length: 0
Authorization: Bearer ya29.GlseBoHbz-SSMNdBt4CZzIoS0-4TxssVDxxa5Ib3U5FQhww8N8c3wk6Xy-uImyg9RVB8ogP_e-_M5kZ0lG-OfkLZmlofnJ4eCou1gRERhyv_Kijj2n3S4Ibxg48O
HTTP/1.1 403 Forbidden
Content-length: 298
Expires: Thu, 20 Sep 2018 23:01:16 GMT
X-guploader-uploadid: AEnB2UocixHqTdwq-e3DKumvoepRCJ4VbWSRgF5bYp20OV4ciz_9ImfsAT6CGoWEq78oOThUpfNtrPfRJYgmy5tn_uIG3cCqBw
Cache-control: private, max-age=0
Date: Thu, 20 Sep 2018 23:01:16 GMT
Content-type: application/xml; charset=UTF-8
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>eamon.white7@gmail.com does not have storage.objects.get access to gcf-upload-us-central1-42327ef0-9b18-406c-9b7e-7b716bb814f8/d84bdea4-ba16-4260-93c8-c46c2d4066f0.zip.</Details></Error>

简而言之,它说:

eamon.white7@gmail.com does not have storage.objects.get access to gcf-upload-us-central1-42327ef0-9b18-406c-9b7e-7b716bb814f8/d84bdea4-ba16-4260-93c8-c46c2d4066f0.zip