title: Firebase functions crashes while accessing firestore
body: <p>Could you please find an error in following code?</p>
  <pre><code>const functions = require(&quot;firebase-functions&quot;);
  const admin = require(&quot;firebase-admin&quot;);
  admin.initializeApp();
  
  
  
  exports.GetShort = functions.https.onRequest((request, response) =&gt; {
      response.header(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
      longURL = request.query.long
      functions.logger.info(&quot;url is - &quot; ,longURL)
      SaveToDB(longURL)
  })
  
  
  function SaveToDB(link){
      functions.logger.info(&quot;here&quot;)
      admin.firestore().collection(&quot;url&quot;).where(&quot;urlNames&quot;,&quot;array_contains&quot;,link).get().then(
    
          function(querySnapshot){
              functions.logger.info(&quot;snap, &quot; ,querySnapshot)
              querySnapshot.forEach(function(doc) {
              functions.logger.info(&quot;things :  &quot; ,doc.id, &quot; =&gt; &quot;, doc.data())
  
                  // doc.data() is never undefined for query doc snapshots
                  console.log(doc.id, &quot; =&gt; &quot;, doc.data());
              });
          }
      ) .catch(function(error) {
          functions.logger.info(&quot;Error getting documents: &quot;, error);
      });
  }
  </code></pre>
  <p>After hitting above function, firebase-functions logs displays logs till <strong>&quot;here&quot;</strong>. After that it crashes without any more logs/stacktrace.</p>
  <p>below is the contents of packages.json from functions directory.</p>
  <pre><code>{
    &quot;name&quot;: &quot;functions&quot;,
    &quot;description&quot;: &quot;Cloud Functions for Firebase&quot;,
    &quot;scripts&quot;: {
      &quot;lint&quot;: &quot;eslint .&quot;,
      &quot;serve&quot;: &quot;firebase emulators:start --only functions&quot;,
      &quot;shell&quot;: &quot;firebase functions:shell&quot;,
      &quot;start&quot;: &quot;npm run shell&quot;,
      &quot;deploy&quot;: &quot;firebase deploy --only functions&quot;,
      &quot;logs&quot;: &quot;firebase functions:log&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;14&quot;
    },
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;dependencies&quot;: {
      &quot;firebase-admin&quot;: &quot;^9.8.0&quot;,
      &quot;firebase-functions&quot;: &quot;^3.14.1&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;eslint&quot;: &quot;^7.6.0&quot;,
      &quot;eslint-config-google&quot;: &quot;^0.14.0&quot;,
      &quot;firebase-functions-test&quot;: &quot;^0.2.0&quot;
    },
    &quot;private&quot;: true
  }
  </code></pre>