title: Firestore (4.10.1): Could not reach Firestore backend. Firestore Access Issues In Cloud Functions
body: <p>Quick question. Long story short, I am getting this error in my google cloud functions log:</p>
  
  <p>Firestore (4.10.1): Could not reach Firestore backend. </p>
  
  <p>Here is my code in my functions file:</p>
  
  <pre><code> // pull in firebase
      const firebase = require('firebase');
      // required
      require("firebase/firestore");
      // initialize firebase
      const firebaseApp = firebase.initializeApp({
        // Firebase configuration.
          apiKey: "&lt;Key Here&gt;",
          authDomain: "&lt;Auth Domain&gt;",
          databaseURL: "&lt;database url&gt;",
          projectId: "&lt;project id&gt;",
          storageBucket: "&lt;storage bucket&gt;",
          messagingSenderId: "&lt;messaging sender id&gt;"
      });
  
      // setup the firestore
      var fs = firebaseApp.firestore();
  
  exports.search = functions.https.onRequest((request, response) =&gt; {
    cors(request, response, () =&gt; {
  
      // set a reference to the foo table in firestore
            var docRef = fs.collection("foo");
            // check for the foo in the firestore
             docRef.where('bar', '==', &lt;something&gt;).get().then(function(doc) {
              if (!doc.docs) {
                  return db.collection("foo").add({
                    bar: &lt;something&gt;
                })
                .then(function(docRef) {
                    console.log("Document written with ID: ", docRef.id);
                })
                .catch(function(error) {
                    console.error("Error adding document: ", error);
                });
              }
            });
       });
   });
  </code></pre>
  
  <p>At this point I am stuck. As far as I can tell, I have things set up, but maybe not? I have searched the docs and googled the issue, without much success. Do you see anything wrong?</p>