title: rxjs: EmptyError: no elements in sequence
body: <p>I am getting an error</p>
  
  <blockquote>
    <p>'EmptyError: no elements in sequence' error when I go to
    localhost:8080.</p>
  </blockquote>
  
  <p>I have seen the thread <a href="https://stackoverflow.com/questions/47614771/angular-5-emptyerror-no-elements-in-sequence-while-making-child-routes">Angular 5 EmptyError: no elements in sequence while making child routes</a> but none of the answers seem to apply.</p>
  
  <p>I have <code>"rxjs": "^5.5.6"</code> and in my routes, I tried adding <code>pathMatch: 'full',</code> but the error is still displayed.</p>
  
  <p>Extract of my app-routing-module.ts</p>
  
  <pre><code>const routes: Routes = [
      {
          pathMatch: 'full', /* added recently for test purposes*/
          path: '',
          component: RootComponent,
          canActivate: [AuthGuard],
          children: [
              {
                  pathMatch: 'full', /* added recently for test purposes*/
                  path: '',
                  component: RootLoggedComponent
              },
  </code></pre>
  
  <p>This only happened recently, after I added a http Interceptor:</p>
  
  <pre><code>export class myInterceptor implements HttpInterceptor {
      constructor(
          private router: Router
      ) {
  
      }
  
      intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
  
          return next.handle(request)
              .pipe(catchError(err =&gt; {
                  if (err instanceof HttpErrorResponse) {
                      if (err.status === 401) {
                          this.router.navigate(['/login']);
                      }
                  }
                  return Observable.empty&lt;HttpEvent&lt;any&gt;&gt;();
              }));
      }
  }
  </code></pre>
  
  <p>Edit: </p>
  
  <p>This is the full stacktrace that is printed on the console:</p>
  
  <pre><code>ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence
  EmptyError: no elements in sequence
      at new EmptyError (EmptyError.js:22)
      at FirstSubscriber.push../node_modules/rxjs/_esm5/operators/first.js.FirstSubscriber._complete (first.js:148)
      at FirstSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at CatchSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at CatchSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at FilterSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at new EmptyError (EmptyError.js:22)
      at FirstSubscriber.push../node_modules/rxjs/_esm5/operators/first.js.FirstSubscriber._complete (first.js:148)
      at FirstSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at CatchSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at CatchSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at MapSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete (Subscriber.js:120)
      at FilterSubscriber.push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._complete (Subscriber.js:138)
      at resolvePromise (zone.js:814)
      at resolvePromise (zone.js:771)
      at zone.js:873
      at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
      at Object.onInvokeTask (core.js:4751)
      at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
      at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
      at drainMicroTaskQueue (zone.js:595)
      at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
      at invokeTask (zone.js:1540)
  defaultErrorLogger @ core.js:1449
  push../node_modules/@angular/core/esm5/core.js.ErrorHandler.handleError @ core.js:1510
  next @ core.js:5508
  schedulerFn @ core.js:4342
  push../node_modules/rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:243
  push../node_modules/rxjs/_esm5/Subscriber.js.SafeSubscriber.next @ Subscriber.js:190
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:131
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/Subject.js.Subject.next @ Subject.js:56
  push../node_modules/@angular/core/esm5/core.js.EventEmitter.emit @ core.js:4322
  (anonymous) @ core.js:4782
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
  push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
  push../node_modules/@angular/core/esm5/core.js.NgZone.runOutsideAngular @ core.js:4708
  onHandleError @ core.js:4782
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:392
  push../node_modules/zone.js/dist/zone.js.Zone.runGuarded @ zone.js:154
  _loop_1 @ zone.js:677
  api.microtaskDrainDone @ zone.js:686
  drainMicroTaskQueue @ zone.js:602
  push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:500
  invokeTask @ zone.js:1540
  globalZoneAwareCallback @ zone.js:1566
  error (async)
  customScheduleGlobal @ zone.js:1666
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:407
  onScheduleTask @ zone.js:297
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:401
  push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:232
  push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask @ zone.js:258
  (anonymous) @ zone.js:1831
  (anonymous) @ http.js:2353
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ScalarObservable.js.ScalarObservable._subscribe @ ScalarObservable.js:51
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/filter.js.FilterOperator.call @ filter.js:61
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/first.js.FirstOperator.call @ first.js:71
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ArrayObservable.js.ArrayObservable._subscribe @ ArrayObservable.js:116
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/every.js.EveryOperator.call @ every.js:34
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ArrayObservable.js.ArrayObservable._subscribe @ ArrayObservable.js:116
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/every.js.EveryOperator.call @ every.js:34
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ArrayObservable.js.ArrayObservable._subscribe @ ArrayObservable.js:116
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/every.js.EveryOperator.call @ every.js:34
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/every.js.EverySubscriber.notifyComplete @ every.js:54
  push../node_modules/rxjs/_esm5/operators/every.js.EverySubscriber._complete @ every.js:71
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete @ Subscriber.js:120
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._complete @ mergeMap.js:143
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete @ Subscriber.js:120
  push../node_modules/rxjs/_esm5/observable/ArrayObservable.js.ArrayObservable._subscribe @ ArrayObservable.js:118
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/every.js.EveryOperator.call @ every.js:34
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber.notifyNext @ mergeMap.js:151
  push../node_modules/rxjs/_esm5/InnerSubscriber.js.InnerSubscriber._next @ InnerSubscriber.js:25
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ScalarObservable.js.ScalarObservable._subscribe @ ScalarObservable.js:51
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber.notifyNext @ mergeMap.js:151
  push../node_modules/rxjs/_esm5/InnerSubscriber.js.InnerSubscriber._next @ InnerSubscriber.js:25
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/observable/ScalarObservable.js.ScalarObservable._subscribe @ ScalarObservable.js:51
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  subscribeToResult @ subscribeToResult.js:23
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._innerSub @ mergeMap.js:138
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._tryNext @ mergeMap.js:135
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._next @ mergeMap.js:118
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:131
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/map.js.MapSubscriber._next @ map.js:85
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:95
  push../node_modules/rxjs/_esm5/operators/last.js.LastSubscriber._complete @ last.js:111
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete @ Subscriber.js:120
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapSubscriber._complete @ mergeMap.js:143
  push../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.complete @ Subscriber.js:120
  push../node_modules/rxjs/_esm5/observable/ScalarObservable.js.ScalarObservable._subscribe @ ScalarObservable.js:53
  push../node_modules/rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:160
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/last.js.LastOperator.call @ last.js:40
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  push../node_modules/rxjs/_esm5/operators/map.js.MapOperator.call @ map.js:57
  push../node_modules/rxjs/_esm5/Observable.js.Observable.subscribe @ Observable.js:157
  (anonymous) @ Observable.js:204
  ZoneAwarePromise @ zone.js:891
  push../node_modules/rxjs/_esm5/Observable.js.Observable.forEach @ Observable.js:200
  push../node_modules/@angular/router/esm5/router.js.Router.activateRoutes @ router.js:5544
  (anonymous) @ router.js:5505
  ZoneAwarePromise @ zone.js:891
  push../node_modules/@angular/router/esm5/router.js.Router.runNavigate @ router.js:5436
  (anonymous) @ router.js:5391
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
  onInvoke @ core.js:4760
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:387
  push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
  (anonymous) @ zone.js:872
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:421
  onInvokeTask @ core.js:4751
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:420
  push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:188
  drainMicroTaskQueue @ zone.js:595
  Promise.then (async)
  scheduleMicroTask @ zone.js:578
  push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
  push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:232
  push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:252
  scheduleResolveOrReject @ zone.js:862
  ZoneAwarePromise.then @ zone.js:962
  push../node_modules/@angular/core/esm5/core.js.PlatformRef.bootstrapModule @ core.js:5579
  ./src/main.ts @ main.ts:11
  __webpack_require__ @ bootstrap:76
  0 @ main.ts:12
  __webpack_require__ @ bootstrap:76
  checkDeferredModules @ bootstrap:43
  webpackJsonpCallback @ bootstrap:30
  (anonymous) @ main.js:1
  </code></pre>
  
  <p>And this is the function returned by my AuthGuard:</p>
  
  <pre><code>isAuthenticated(): Observable&lt;boolean&gt; {
          return this.http.post('/isAuth', {}).pipe(
              map(() =&gt; {
                  console.log('this is not printed in the console');
                  return true;
              }),
              catchError((err) =&gt; {
                  console.log('this either, strangely enough?');
                  this.router.navigate(['/login']);
                  return Observable.of(false);
              }));
  </code></pre>
  
  <p>Edit2:</p>
  
  <p>returning of(new HttpResponse()) removes the stacktrace, but creates a bug in this function (it doesn't go in the catchError even though the user is not logged in):</p>
  
  <pre><code>isAuthenticated(): Observable&lt;boolean&gt; {
      return this.http.post('/isAuth', {}).pipe(
          map(() =&gt; {
              this.loggedIn.next(true);
              return true;
          }),
          catchError((err) =&gt; {
              this.loggedIn.next(false);
              this.router.navigate(['/login']);
              return Observable.of(false);
          }));
  </code></pre>