firebase 功能 - `firebase deploy` - 该服务当前不可用

标签 firebase command-line google-cloud-platform undefined google-cloud-functions

我尝试运行 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。我的帐户被暂停后,我执行了 here 描述的程序,并成功将其恢复。在我删除并创建所有必要的凭据(API key /服务帐户/ouath 客户端 ID)后,此问题才开始发生。

我尝试过 firebase logout 然后 firebase login 但部署失败。我也尝试过 npm install -g firebase-tools@latestfirebase use --add <myproject> (我不确定那应该做什么)。我什至重新运行了 firebase-tools 安装,但这仍然没有帮助。

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

任何想法将不胜感激。

更新

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

更新

我也尝试过重置 gcloud 凭据,但没有成功:

./gcloud auth application-default login

更新

我运行了 firebase deploy --only functions --debug ,这里是更多输出:

i functions: updating Node.js 6 function sendMessageNotification(us-central1)... [2018-09-20T22:28:14.587Z] Trigger is: {"eventTrigger":{"resource":"projects/PROJECT_ID/databases/(default)/documents/messages/{messageId}","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/PROJECT_ID/locations/us-central1/functions/sendMessageNotification query params: {"updateMask":"sourceUploadUrl,name,labels,eventTrigger.resource,eventTrigger.eventType,eventTrigger.service"} sourceUploadUrl=https://storage.googleapis.com/ name=projects/PROJECT_ID/locations/us-central1/functions/Function, deployment-tool=cli-firebase, resource=projects/PROJECT_ID/databases/(default)/documents/messages/{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>user@gmail.com does not have storage.objects.get access to Function-us-central1-FILE.zip.</Details></Error>

简而言之,它说:

user@gmail.com 没有 storage.objects.get 访问 gFunction-us-central1-FILE.zip 的权限

最佳答案

问题可能是您删除了 "Google App Engine's 'default service account'"如本 S.O. 中的详细信息发布。

不幸的是,当这种情况发生时,你可能不得不销毁谷歌云项目并重新制作它。请参阅链接的帖子了解更多信息。

关于firebase 功能 - `firebase deploy` - 该服务当前不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52433573/

相关文章:

javascript - 如何将从 useEffect 中获取的初始值放入文本字​​段中?

android - Android 忽略 FCM 通知优先级

ios - Firebase Swift - 当搜索 Controller 过滤结果时,实时更新不起作用

ruby - 获取包含毫秒的时间戳

java - Google 云 Bigquery UDF 限制

android - 如何在带有 Firebase 内容的 Android 中使用 Algolia

windows - 批处理文件标记忽略空分隔符

linux - 使用 Bash 自动将最后一个命令的输出捕获到变量中?

https - Airflow 中用于 HTTPS 的 HttpOperator 或 HttpHook

python - 如何从 Google 云函数返回 JSON