title: Angular 6 with NGRX getting "You provided 'undefined' where a stream was expected.upon dispatch"
body: <p>I'm trying to fetch some recipes over an API using ngrx and an interceptor that checks the URL to determine what kind of auth tokens that should be used. But for some reason that I have not manage to figure out I get and the following error: </p>
  
  <pre><code>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:6)
      at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._innerSub (mergeMap.js:70)
      at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (mergeMap.js:67)
      at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (mergeMap.js:50)
      at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:54)
      at Observable._subscribe (scalar.js:5)
      at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable._trySubscribe (Observable.js:42)
      at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:28)
      at MergeMapOperator.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapOperator.call (mergeMap.js:28)
  </code></pre>
  
  <p>Below is where I try to dispatch the action when my component is initiated:</p>
  
  <pre><code>constructor(private router: Router,
                    private route: ActivatedRoute,
                    private store: Store&lt;fromRecipe.FeatureState&gt;) { }
  
    ngOnInit() {
      this.recipeState = this.store.select('recipes');
      this.store.dispatch(new RecipeActions.FetchRecipesFromApi());
    }
  </code></pre>
  
  <p>This is the effect action that gets called:</p>
  
  <pre><code>@Effect()
      recipesFetchFromAPI = this.actions$
          .ofType(RecipeActions.FETCH_RECIPES_FROM_API)
          .pipe(switchMap((action: RecipeActions.FetchRecipesFromApi) =&gt; {
              return this.httpClient.get&lt;ApiSearch&gt;('https://api.edamam.com/search')
              }),
              map(
                  (searchResult) =&gt; {
                      return {
                          type: RecipeActions.SET_RECIPES,
                          payload: searchResult.hits
                      }
                  }
              )
          );
  </code></pre>
  
  <p>This is my interceptor that checks what url the request is from.</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler) : Observable&lt;HttpEvent&lt;any&gt;&gt;{
          if(req.url == 'https://ng-recipe-book-55fbc.firebaseio.com/recipes.json'){
              return this.store.select('auth')
                  .pipe(
                      take(1),
                      switchMap((authState: fromAuth.State) =&gt; {
                          const clonedReq = req.clone({params: req.params.set('auth', authState.token)});
                          return next.handle(clonedReq);
                      })
                  );
          } else if (req.url == 'https://api.edamam.com/search?q=chicken') {
              const clonedReq = req.clone({params: req.params.set('app_id', '123').set('app_key', '123')});
              return next.handle(clonedReq);
          }
      }
  </code></pre>
  
  <p>My other actions, reducers and effects are working but this one. I have browsed the forum but have not managed to find a solution for this perticular problem. Does anyone have an idea of what is causing this? I would happily provide more code/information if that's needed. </p>