Listening to foreground messages fails with: this.onMessageInternal is not a function
Version info
Angular: 5.2.0
Firebase: 5.5.0
AngularFire: 5.0.1
How to reproduce these conditions
The following snippet:
import { AngularFireMessaging } from '@angular/fire/messaging';
constructor(private fcm: AngularFireMessaging) { }
public monitor() {
this.fcm.getToken.toPromise().then((token) => {
this.fcm.messages.subscribe(msg => console.log(msg));
});
}
Fails with the stacktrace:
ERROR TypeError: this.onMessageInternal is not a function at Observable.WindowController.onMessage [as _subscribe] (index.esm.js:1868) at Observable._trySubscribe (Observable.js:42) at Observable.subscribe (Observable.js:28) at eval (subscribeTo.js:21) at subscribeToResult (subscribeToResult.js:11) at SwitchMapSubscriber._innerSub (switchMap.js:50) at SwitchMapSubscriber._next (switchMap.js:41) at SwitchMapSubscriber.Subscriber.next (Subscriber.js:55) at eval (angularfire2.js:65) at ZoneDelegate.invoke (zone.js:388)
Basically, I'm following the example on how to listen to foreground messages from the docs.
Am I doing something wrong?
Thanks!
Duplicate of #1855, will fix in the next release