How to determine where this error came from?

I was checking my console and saw this error, i want to determine from which section of the code it is to fix, but error doesn't show this. How do debug this ?

subscribeTo.js and other files are modules file, not mine

ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
    at subscribeTo (subscribeTo.js:41)
    at subscribeToResult (subscribeToResult.js:11)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._innerSub (mergeMap.js:74)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (mergeMap.js:68)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (mergeMap.js:51)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/ (Subscriber.js:53)
    at Observable._subscribe (subscribeToArray.js:5)
    at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable._trySubscribe (Observable.js:43)
    at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:29)
    at MergeMapOperator.push../node_modules/rxjs/_esm5/internal/operators/ (mergeMap.js:29)

2 answers

  • answered 2019-11-08 13:40 Athanasios Kataras

    1st check your console in network tab to see if any call fails. If that's the case check your calls.

    2nd. Go to your pipes and add a catch error clause. The error in your handling will return the project. Check the second answer here: Angular 4 - Observable catch error

    3rd. Start debugging mode in vs code if that's your environment.

  • answered 2019-11-08 14:08 english_wife

    I have found the reason of error. Be careful with new static field of ViewChild

    @ViewChild(MatSort, {static: true}) paginator: MatPaginator;

    I have changed to

    @ViewChild(MatSort, {static: false}) paginator: MatPaginator;

    And error disappeared