title: Cloud Firestore function in IONIC 4
body: <p>I am quiet new to ionic and cloud function and I have tried to implement a cloud function with some reading but I am not sure if I use it correctly.. I would like to retrieve some collections of my db in firebase. </p>
  
  <p>I have a cloud function in firestore to retrieve the collection of my db in my ionic4 app : </p>
  
  <pre><code>const admin = require('firebase-admin');
  const cors = require('cors')({ origin: true });
  
  admin.initializeApp();
  exports.getCollections = functions.https.onCall(async (data: any, context: any) =&gt; {
      cors(data, context, () =&gt; {
      const collections =  admin.firestore().listCollections();
      const collectionIds = collections.map((col: { id: any; }) =&gt; col.id);
  
      return { collections: collectionIds };
      });
  
  });
  </code></pre>
  
  <p>Then, to make a test, I just print the response using this code in my template : </p>
  
  <pre><code>  callCloudFunction() {
      this.http
        .get(
          'https://us-central1-projet-fred.cloudfunctions.net/getCollections')
        .subscribe((data: any) =&gt; {
          console.log(data);
          this.firebaseReply = data.text;
        });
    }
  </code></pre>
  
  <p>But I got an error in the console. I am not sure I am using this function correctly.. Maybe I have to give parameters to it... </p>
  
  <p><a href="https://i.stack.imgur.com/nVbEC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nVbEC.png" alt="enter image description here"></a></p>