title: Firebase cloud functions onCreate painfully slow to update database
body: <p>I am having a slightly odd issue, and due to the lack of errors, I am not exactly sure what I am doing wrong. What I am trying to do is on an <code>onCreate</code> event, make an API call, and then update a field on the database if the field is not set to <code>null</code>. Based on my console logs for cloud functions, I can see the API call getting a <code>ok</code>, and everything is working properly, but after about 2-5 minutes, it will update. A few times, it didnt update after 15 mins. What is causing such a slow update?</p>
  
  <p>I have eliminated the <code>gaxios</code> call as the bottleneck simply from the functions logs, and local testing. </p>
  
  <p>Some context: I am on the firebase blaze plan to allow for egress and my dataset isnt really big. I am using <code>gaxios</code> because it is already part of firebase-funcstions npm install. </p>
  
  <p>The code is:</p>
  
  <pre><code>const functions = require('firebase-functions');
  const { request } = require('gaxios');
  const { parse } = require('url');
  
  exports.getGithubReadme = functions.firestore.document('readmes/{name}').onCreate((snapshot, context) =&gt; {
      const toolName = context.params.name;
      console.log(toolName);
      const { name, description, site } = snapshot.data();
      console.log(name, description, site);
  
      const parsedUrl = parse(site);
      console.log(parsedUrl);
  
      if (description) return;
  
      if (parsedUrl.hostname === 'github.com') {
          let githubUrl = `https://api.github.com/repos${parsedUrl.path}/readme`;
          request({
              method : 'GET',
              url    : githubUrl
          })
              .then((res) =&gt; {
                  let { content } = res.data;
                  return snapshot.ref.update({ description: content });
              })
              .catch((error) =&gt; {
                  console.log(error);
                  return null;
              });
      }
      return null;
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kCnQ2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kCnQ2.png" alt="Screenshot showing 2 minutes to update"></a></p>