Platform: Error Store is not an instance of Observable

Created on 10 Oct 2018  路  2Comments  路  Source: ngrx/platform

Minimal reproduction of the bug/regression with instructions:

I keep getting an error You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. when I try to access store in effect.

Code:

@Effect()
  getHoles$ = this.actions$.pipe(
    ofType<GetTreeHoles>(HolesActions.GetTreeHoles),
    withLatestFrom(this.store.pipe(select(getLastDocumentSnapshot))),
...

It throws an error at the code:

exports.subscribeTo = function (result) {
    if (result instanceof Observable_1.Observable) {

Apparently, type Store is not an instance of Observable. So it goes to error case like below:

else {
        var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'";
        var msg = "You provided " + value + " where a stream was expected."
            + ' You can provide an Observable, Promise, Array, or Iterable.';
        throw new TypeError(msg);
    }

However, Store extends Observable.

The version I use:
"@ngrx/store": "^6.1.0",
"rxjs": "~6.2.0",

Expected behavior:

Not throw an error when trying to access store in effect.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

"@ngrx/store": "^6.1.0",
"rxjs": "~6.2.0",
"@angular/common": "^6.1.0",

node version: v8.10.0

Other information:

I would be willing to submit a PR to fix this issue

[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x] No

Store question

Most helpful comment

never mind. i figure out the issue.
I import from wrong path
instead of importing from import { catchError, switchMap, withLatestFrom } from 'rxjs/operators';
i imported from import { catchError, switchMap, withLatestFrom } from 'rxjs/internal/operators';

All 2 comments

Could you show your complete effects file?
And just to be sure, you're using ngrx/effects v6.1.0 right?

never mind. i figure out the issue.
I import from wrong path
instead of importing from import { catchError, switchMap, withLatestFrom } from 'rxjs/operators';
i imported from import { catchError, switchMap, withLatestFrom } from 'rxjs/internal/operators';

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hccampos picture hccampos  路  3Comments

smorandi picture smorandi  路  3Comments

brandonroberts picture brandonroberts  路  3Comments

bhaidar picture bhaidar  路  3Comments

sandangel picture sandangel  路  3Comments