title: Firebase cloud function; unable to reach firestore database
body: <p>I have a firebase cloud function (http request) in which I want to update a document in my firestore database</p>
  
  <pre><code>const functions = require('firebase-functions')
  const admin = require('firebase-admin');
  admin.initializeApp();
  
  exports.webhook = functions.https.onRequest(async (req, res) =&gt; {
  const { id } = req.body
  
  
  // Create payment
  exports.webhook = functions.https.onRequest(async (req, res) =&gt; {
      const { id } = req.body
  
      // Create payment
      try {
        console.log(id)
        console.log('test before db call')
  
        admin.firestore().collection('payments').doc(id).update(
          {
              status: "paid"
          }
        ).then(() =&gt; {
            console.log('success')
        })
  
        console.log('test after db call')
  
        res.send('ok')
      } catch (e) {
        res.send('not ok')
      }
    })
  </code></pre>
  
  <p>Function is deploying, <code>console.log(id)</code> is correct but whenever I call <code>admin.firestore()</code> it doesn't print anything anymore.
  Commenting that part prints 'promise resolved'
  I have the impression I can't access or use wrong syntax to get to the Firestore db but I can't see why?</p>
  
  <p>Firebase logs are printing:</p>
  
  <blockquote>
    <p>Function execution started</p>
    
    <p>tr_........ (id)</p>
    
    <p>test before db call</p>
    
    <p>Function execution took 1103 ms, finished with status code: 200</p>
  </blockquote>