问题
Yesterday everything worked perfectly, this morning I noticed chrome is introducing a new interface, afterwards I checked the chrome version, it is now updated to v69. So far so good. I then ran my server which is linked to firebase. But I started getting this:
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
Long error made short: Messaging: This browser doesn't support the API's required to use the firebase SDK
Downgrading to chrome 68 is a solution, but does anyone have a better idea?
EDIT:
System information: Pop!_OS 18.04 LTS Linux (64-bit)
Chrome version: 69.0.3497.81 (Official Build) (64-bit)
Node version: v10.9.0
EDIT:
The server works just fine while deployed to production, and firefox.
回答1:
This problem occurs when you are not using HTTPS or localhost
. This is documented in the official documentations: source
The FCM SDK is supported only in pages served over HTTPS. This is due to its use of service workers, which are available only on HTTPS sites.
Of course, your problem was caused for using 0.0.0.0 instead of localhost
which was correctly pointed out by Noureldean Swearky.
回答2:
edit: https://github.com/firebase/firebase-js-sdk/issues/1220#issuecomment-421317994
Must be a problem with SSL
I was testing in Amazon S3 Bucket with no SSL..
For Now the only solution I see is checking the chrome version and disable firebase in 69.
It broke an entire app, Im working on. We using Firebase Cloud Messaging for Push Notifications , and all was well until Chrome 68.
In localhost is working, but at production not.
Updated the scripts :
https://www.gstatic.com/firebasejs/5.5.0/firebase-app.js https://www.gstatic.com/firebasejs/5.5.0/firebase-messaging.js
and no success.
funny thing: when i debug chrome
if ('Notification' in window) {
console.log('supported'); } else {
console.log(' not supported'); }
it says push API is supported.
回答3:
SOLUTION
I was working on 0.0.0.0:8000
, changed it to localhost:8000
and it worked, some would argue the huge difference, I would argue the opposite...
回答4:
try the latest Firebase JS library Version 5.4.2 - August 30, 2018
.
Fixed an issue where the
navigator
global was unavailable in some environments.
... while the NodeJS
version is pretty irrelevant.
回答5:
This looks like a bug/spec violation in Firefox. In the current version of Firefox Nightly (version 64), it will also throw this error.
来源:https://stackoverflow.com/questions/52199810/chrome-69-doesnt-support-firebase-sdk