【问题标题】:Chrome 69 doesn't support Firebase SDKChrome 69 不支持 Firebase SDK
【发布时间】:2019-02-11 11:10:39
【问题描述】:

昨天一切正常,今天早上我注意到chrome正在引入一个新界面,后来我检查了chrome版本,现在已经更新到v69。到目前为止,一切都很好。 然后我运行了连接到 firebase 的服务器。但我开始明白了:

09:46:30.598 index.esm.js?76ac:2069 Uncaught FirebaseError {code: "messaging/unsupported-browser", message: "Messaging: This browser doesn't support the API's …he firebase SDK. (messaging/unsupported-browser).", stack: "FirebaseError: Messaging: This browser doesn't sup….0.0.0:8000/index.js?d00bc69e0c69f561d4af:2672:1)"}code: "messaging/unsupported-browser"message: "Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser)."stack: "FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).
at Object.factoryMethod [as messaging] (webpack-internal:///311:2077:32)
at FirebaseAppImpl._getService (webpack-internal:///30:134:66)
at FirebaseAppImpl.(anonymous function) [as messaging] (webpack-internal:///30:323:31)
at Object.serviceNamespace [as messaging] (webpack-internal:///30:308:32)
at eval (webpack-internal:///66:51:36)
at Object.<anonymous> (http://0.0.0.0:8000/index.js?d00bc69e0c69f561d4af:1240:1)
at __webpack_require__ (http://0.0.0.0:8000/index.js?d00bc69e0c69f561d4af:708:30)
at fn (http://0.0.0.0:8000/index.js?d00bc69e0c69f561d4af:113:20)
at eval (webpack-internal:///286:55:11)
at Object.<anonymous> (http://0.0.0.0:8000/index.js?d00bc69e0c69f561d4af:2672:1)"__proto__: Error

长错误变短:Messaging: This browser doesn't support the API's required to use the firebase SDK

降级到 chrome 68 是一种解决方案,但有人有更好的主意吗?

编辑:

系统信息:Pop!_OS 18.04 LTS Linux (64-bit)

Chrome 版本:69.0.3497.81(官方版本)(64 位)

节点版本:v10.9.0

编辑:

服务器在部署到生产环境和 firefox 时工作正常。

【问题讨论】:

    标签: firebase google-chrome firebase-realtime-database browser-support


    【解决方案1】:

    试试最新的 Firebase JS 库Version 5.4.2 - August 30, 2018

    修复了 navigator 全局在某些环境中不可用的问题。

    ...而NodeJS 版本则无关紧要。

    【讨论】:

      【解决方案2】:

      这看起来像是 Firefox 中的错误/规范违规。在当前版本的 Firefox Nightly(版本 64)中,也会抛出这个错误。

      【讨论】:

      • 所以它在firefox上工作是firefox中的一个错误?我不这么认为,它在以前的 chrome 上完美运行,这样的错误会被 chrome 和 firebase 组合大小的社区立即捕获。你不同意吗?
      【解决方案3】:

      解决方案

      我正在研究0.0.0.0:8000,将其更改为localhost:8000,它起作用了,有些人会认为差异很大,我会认为相反......

      【讨论】:

        【解决方案4】:

        编辑:https://github.com/firebase/firebase-js-sdk/issues/1220#issuecomment-421317994

        一定是 SSL 的问题

        我在没有 SSL 的 Amazon S3 存储桶中进行测试..

        目前我看到的唯一解决方案是检查 chrome 版本并在 69 中禁用 firebase。

        它破坏了整个应用程序,我正在处理。我们使用 Firebase Cloud Messaging 进行推送通知,在 Chrome 68 之前一切都很好。

        在 localhost 中可以工作,但在生产中没有。

        更新了脚本:

        https://www.gstatic.com/firebasejs/5.5.0/firebase-app.js https://www.gstatic.com/firebasejs/5.5.0/firebase-messaging.js

        没有成功。

        有趣的事情:当我调试 chrome 时

        if ('Notification' in window) {
          console.log('supported'); } else {
         console.log(' not supported'); }
        

        它说支持推送 API。

        【讨论】:

        • 根据 9 月 27 日的评论:github.com/firebase/firebase-js-sdk/issues/… firebase.messaging 在 Service Worker 中实现需要 HTTPS。如果你需要在本地测试,我建议在你的项目文件夹中运行firebase serve
        【解决方案5】:

        当您不使用 HTTPS 或 localhost 时会出现此问题。这记录在官方文档中:source

        仅在通过 HTTPS 提供的页面中支持 FCM SDK。这个到期了 对其使用服务工作人员,这些服务工作人员仅在 HTTPS 上可用 网站。

        当然,您的问题是因为使用 0.0.0.0 而不是 localhost

        【讨论】:

          猜你喜欢
          • 2013-07-08
          • 1970-01-01
          • 2019-12-06
          • 2017-01-30
          • 1970-01-01
          • 2016-03-16
          • 2016-05-20
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多