title: ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable in Angular Services
body: <p>I have written multiple services to hit different APIs. The services written for post are working somehow but giving this error</p>
  
  <blockquote>
    <p>ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
        at subscribeTo (subscribeTo.js:27)</p>
  </blockquote>
  
  <p>As for the services written for the GET method the same error is shown but i get no data in return. 
  Here is my service</p>
  
  <pre><code>GetClientData(): Observable&lt;ClientDto&gt; {
      let url_ = this.baseUrl + "https://xxxxxxxxxxxxxxxx/getClients";
      url_ = url_.replace(/[?&amp;]$/, "");
  
      let options_ : any = {
          observe: "response",
          responseType: "blob",
          headers: new HttpHeaders({
              "Accept": "application/json"
          })
      };
  
      return this.http.request("get", url_, options_).pipe(_observableMergeMap((response_ : any) =&gt; {
          return this.processGetAllPermissions(response_);
      })).pipe(_observableCatch((response_: any) =&gt; {
          if (response_ instanceof HttpResponseBase) {
              try {
                  return this.processGetAllPermissions(&lt;any&gt;response_);
              } catch (e) {
                  return &lt;Observable&lt;ClientDto&gt;&gt;&lt;any&gt;_observableThrow(e);
              }
          } else
              return &lt;Observable&lt;ClientDto&gt;&gt;&lt;any&gt;_observableThrow(response_);
      }));
  }
  
  protected processGetAllPermissions(response: HttpResponseBase): Observable&lt;ClientDto&gt; {
      const status = response.status;
      const responseBlob = 
          response instanceof HttpResponse ? response.body : 
          (&lt;any&gt;response).error instanceof Blob ? (&lt;any&gt;response).error : undefined;
  
      let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }};
      if (status === 200) {
          return blobToText(responseBlob).pipe(_observableMergeMap(_responseText =&gt; {
          let result200: any = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = resultData200 ? ClientDto.fromJS(resultData200) : new ClientDto();
          return _observableOf(result200);
          }));
      } else if (status !== 200 &amp;&amp; status !== 204) {
          return blobToText(responseBlob).pipe(_observableMergeMap(_responseText =&gt; {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
          }));
      }
      return _observableOf&lt;ClientDto&gt;(&lt;any&gt;null);
  }
  </code></pre>
  
  <p>Cloud Function</p>
  
  <pre><code>exports.getClients = functions.https.onRequest((req, res) =&gt; {
  
      res.set('Access-Control-Allow-Origin', 'http://localhost:4200');
      res.set('Access-Control-Allow-Methods', 'GET', 'POST');
      res.set('Access-Control-Allow-Headers', 'Content-Type');
  
      if (req.method === 'OPTIONS') {
          res.end();
      }
  
      else
      {
  
          let allClients = [];
          usersClients.get()
              .then(snapshot =&gt; {
                  snapshot.forEach(doc =&gt; {
                      allClients.push(doc.data());
                  });
                  res.send(200, {
                      "data": allClients
                  })
              })
              .catch(err =&gt; {
                  console.log("Error getting data", err);
              });
      }
  });
  </code></pre>