我正在尝试运行
firebase deploy
,但我得到:
=== Deploying to ...
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。我的帐户被暂停后,我按照此处描述的程序进行操作,并成功恢复了帐户。在我删除并创建所有必要的凭据(API 密钥/服务帐户/ouath 客户端 ID)后,此问题才开始发生。
我尝试过
firebase logout
,然后firebase login
,但部署失败。我也尝试过 npm install -g firebase-tools@latest
和 firebase use --add <myproject>
(我不确定那应该做什么)。我什至重新运行了firebase-tools
安装,但这仍然没有帮助。
我还尝试过从
firebase
编辑 google cloud console
函数,但它不允许我保存,它给了我一个 undefined
错误,以及该问题的跟踪号码,我提供了反馈,但还没有听到任何东西。
任何想法将不胜感激。
更新
这是我的凭据页面,我不确定所有内容是否配置正确,希望可以从中获得一些信息,因为我认为项目可能受到损害并且必须更新密钥与
firebase deploy
有关问题:
更新
我也尝试过重置
gcloud
凭据,但没有成功:
./gcloud auth application-default login
更新
我运行了
firebase deploy --only functions --debug
,这里有更多输出:
i 函数:更新 Node.js 6 函数 sendMessageNotification(us-central1)... [2018-09-20T22:28:14.587Z] 触发器是: {“eventTrigger”:{“resource”:“projects/PROJECT_ID/databases/(默认)/documents/messages/{messageId}”,“eventType”:“providers/cloud.firestore/eventTypes/document.write”,“service ":"firestore.googleapis.com"}} [2018-09-20T22:28:14.588Z] >>> HTTP 请求补丁 https://cloudfunctions.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/functions/sendMessageNotification 查询参数: {“updateMask”:“sourceUploadUrl,名称,标签,eventTrigger.resource,eventTrigger.eventType,eventTrigger.service”} sourceUploadUrl=https://storage.googleapis.com/ 名称=项目/PROJECT_ID/位置/us-central1/functions/函数, 部署工具=cli-firebase, 资源=项目/PROJECT_ID/数据库/(默认)/文档/消息/{messageId}, eventType=providers/cloud.firestore/eventTypes/document.write, service=firestore.googleapis.com [2018-09-20T22:28:15.055Z] <<< HTTP RESPONSE 503 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Thu, 20 Sep 2018 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=The service is currently unavailable., status=UNAVAILABLE ⚠ functions: failed to update function sendMessageNotification HTTP Error: 503, The service is currently unavailable
有趣的是,如果您单击 https://cloudfunctions.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/functions/FUNCTION(来自输出),它会带您到此:
{
"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"
}
}
它说我缺少身份验证凭据...
更新
当我单击上面输出中的
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 /Function-upload-us-central1/FILE.zip
</StringToSign>
</Error>
更新
来自谷歌的
OAuth 2.0 Playground
:
GET /FUNCTION-central1-FILE.zip?GoogleAccessId=Service_Account@gcf-admin-robot.iam.gserviceaccount.com&Expires= HTTP/1.1
Host: storage.googleapis.com
Content-length: 0
Authorization: Bearer
HTTP/1.1 403 Forbidden
Content-length: 298
Expires: Thu, 20 Sep 2018 23:01:16 GMT
X-guploader-uploadid:
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>[email protected] does not have storage.objects.get access to Function-us-central1-FILE.zip.</Details></Error>
简而言之,它说:
[电子邮件受保护] 没有 storage.objects.get 访问 gFunction-us-central1-FILE.zip 的权限
问题可能是您删除了 “Google App Engine 的‘默认服务帐户’”,作为本 S.O. 中的详细信息。发帖。
不幸的是,当这种情况发生时,你可能不得不销毁谷歌云项目并重新制作它。请参阅链接的帖子了解更多信息。
我遇到了类似的问题,但是代码已部署,并且在部署的站点上我可以看到
This page is temporarily unavailable.
。
这是由于将
"site": "abcd"
包含在我的 firbease.json
中(在 hosting
下)引起的。删除它使网站再次运行。