title: Setting timeout in javascript/typescript code for cloud functions
body: <p>I am currently trying to delay some actions with the cloud firestore but the setTimeout/setInterval doesn't seem to work for my code.</p>
  
  <pre><code>export const onTimerCreate = functions.firestore
  
  .document("File/One")
  .onCreate((snapshot, context) =&gt; {
    setTimeout(countdown, 5000);
    const messageData = snapshot.data()
  
    const delay = countdown()
    return snapshot.ref.update ({ delay : delay })
  })
  
  function countdown() {
    return 0
  }
  </code></pre>
  
  <p>I am trying to make sure the snapshot updates with a new value after that delay of 5 seconds but it just happens instantly every time... not sure what to do?</p>