Firebase服务命令失败,错误为404

时间:2018-09-11 16:33:58

标签: firebase firebase-hosting firebase-cli

每当我在Mac上运行firebase serve时,我都会收到404错误...这以前从未发生过,而我只是在使用本地开发服务器之前,大概是在5分钟后才开始发生。我已删除firebase.json文件并重新初始化,重新安装了firebase工具,但每次都失败。这是在调试模式下运行命令的结果。

    firebase serve --debug
[2018-09-11T16:12:25.873Z] ----------------------------------------------------------------------
[2018-09-11T16:12:25.876Z] Command:       /usr/local/bin/node /usr/local/bin/firebase serve --debug
[2018-09-11T16:12:25.877Z] CLI Version:   4.2.1
[2018-09-11T16:12:25.877Z] Platform:      darwin
[2018-09-11T16:12:25.877Z] Node Version:  v6.11.3
[2018-09-11T16:12:25.878Z] Time:          Tue Sep 11 2018 11:12:25 GMT-0500 (CDT)
[2018-09-11T16:12:25.878Z] ----------------------------------------------------------------------

[2018-09-11T16:12:25.890Z] > 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"]
[2018-09-11T16:12:25.890Z] > authorizing via signed-in user
[2018-09-11T16:12:25.893Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/skadaddle-10f24  

[2018-09-11T16:12:26.210Z] <<< HTTP RESPONSE 200 server=nginx, date=Tue, 11 Sep 2018 16:12:26 GMT, content-type=application/json; charset=utf-8, content-length=114, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-09-11T16:12:26.212Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/skadaddle-10f24  

[2018-09-11T16:12:26.385Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Tue, 11 Sep 2018 16:12:26 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

=== Serving from '/Users/Kevin/Desktop/Source/Skadaddle'...

[2018-09-11T16:12:26.388Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/255074367563/clients/_:getWebAppConfig  

[2018-09-11T16:12:26.514Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Tue, 11 Sep 2018 16:12:26 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-11T16:12:26.514Z] <<< HTTP RESPONSE BODY code=404, message=Requested entity was not found., status=NOT_FOUND

Error: HTTP Error: 404, Requested entity was not found.
[2018-09-11T16:12:26.519Z] Error Context: {
  "body": {
    "error": {
      "code": 404,
      "message": "Requested entity was not found.",
      "status": "NOT_FOUND"
    }
  },
  "response": {
    "statusCode": 404,
    "body": {
      "error": {
        "code": 404,
        "message": "Requested entity was not found.",
        "status": "NOT_FOUND"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Tue, 11 Sep 2018 16:12:26 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"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "mobilesdk-pa.googleapis.com",
        "port": 443,
        "hostname": "mobilesdk-pa.googleapis.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v1/projects/255074367563/clients/_:getWebAppConfig",
        "path": "/v1/projects/255074367563/clients/_:getWebAppConfig",
        "href": "https://mobilesdk-pa.googleapis.com/v1/projects/255074367563/clients/_:getWebAppConfig"
      },
      "method": "GET"
    }
  }
}

3 个答案:

答案 0 :(得分:16)

此处的Firebase员工

CLI部署存在一个已知问题。正在调查中。您可以在此处跟踪中断情况:

https://status.firebase.google.com/incident/Hosting/18015

每当遇到这样的CLI失败时,请直接与Firebase支持联系,并提供所有相关详细信息:

https://firebase.google.com/support/

答案 1 :(得分:3)

问题出在Google。运行firebase serve时,它会向https://mobilesdk-pa.googleapis.com发送请求,该请求当前会引发404错误。

我可以通过在node_modules/firebase-tools/lib中编辑3个文件来解决此问题(临时修复)。

api.js的第99行是调用错误URL的地方。只需将其更改为任何有效的非404网址即可。

然后在fetchWebSetup.js中,将"GET"之后第9行的参数更改为空白字符串(例如return api.request("GET", "", {

对第51行的functionsConfig.js执行上述操作。

这应该使您现在开始运行,但是当Google修复该URL时,它应该可以自行解决。

答案 2 :(得分:0)

我只能通过删除.firebaserc然后再次运行firebase init来解决此问题。仅确保您不会错误地覆盖现有配置。