angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Listening to foreground messages fails with: this.onMessageInternal is not a function

Open Wordenskjold opened this issue 8 years ago • 1 comments

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!

Wordenskjold avatar Sep 20 '18 14:09 Wordenskjold

Duplicate of #1855, will fix in the next release

jamesdaniels avatar Sep 20 '18 23:09 jamesdaniels