mikkopaderes / ember-firebase-service

Exposes a service that's a direct representation of Firebase
MIT License
4 stars 2 forks source link

this.firebase.messaging.isSupported() is not a function #56

Open yandiro opened 2 years ago

yandiro commented 2 years ago

Anybody ran into this too?

In browsers where messaging is not supported, the browser crashes, so one needs to check for support before initialising messaging by calling messaging()

mikkopaderes commented 2 years ago

If you want to utilize this addon, make sure you're using Firebase 8. For Firebase 9, this addon isn't needed because of the modular sdk.

yandiro commented 2 years ago

Good to know. So perhaps I should have used Firebase 9 since the beginning.

Anyways, firebase is globally available, so I could simply call firebase.messaging.isSupported().

But isSupported() is available in firebase 8 too, isn't it? https://firebase.google.com/docs/reference/js/v8/firebase.messaging#issupported

mikkopaderes commented 2 years ago

Yes it should be at least based on the docs. If you're following the README correctly then you should be fine unless it's a Firebase issue itself. I would suggest trying to to see if isSupported can be accessed from a plain javascript app instead of an Ember just to rule it out.

yandiro commented 2 years ago

We import the firebase messaging just like you say: app.import('vendor/ember-firebase-service/firebase/firebase-messaging.js'); from within the ember-cli-build.

But is this the same file as node_modules/@firebase/messaging ?

mikkopaderes commented 2 years ago

@yandiro, it's not. It's essentially the firebase/firebase-message.js only that it's guarded to not run in non-FastBoot environment. See FastBoot guide.

Note that this is a file that will be generated during build time

yandiro commented 2 years ago

But generated from the file in the node_modules, right?

mikkopaderes commented 2 years ago

Yes