title: Firebase Functions - ERROR, but no Event Message in Console
body: <p>I have written a function on firebase that downloads an image (base64) from firebase storage and sends that as response to the user:</p>
  
  <pre><code>const functions = require('firebase-functions');
  import os from 'os';
  import path from 'path';
  const storage = require('firebase-admin').storage().bucket();
  
  export default functions.https.onRequest((req, res) =&gt; {
      const name = req.query.name;
  
      let destination = path.join(os.tmpdir(), 'image-randomNumber');
      return storage.file('postPictures/' + name).download({
          destination
      }).then(() =&gt; {
          res.set({
              'Content-Type': 'image/jpeg'
          });
          return res.status(200).sendFile(destination);
      });
  });
  </code></pre>
  
  <p>My client calls that function multiple times <em>after</em> one another (in series) to load a range of images for display, ca. 20, of an average size of 4KB.</p>
  
  <p>After 10 or so pictures have been loaded (amount varies), all other pictures fail. The reason is that my function does not respond correctly, and the firebase console shows me that my function threw an error:</p>
  
  <p><a href="https://i.stack.imgur.com/1Y9Cw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Y9Cw.png" alt="enter image description here"></a></p>
  
  <p>The above image shows that</p>
  
  <ol>
  <li>A request to the function (called "PostPictureView") suceeds</li>
  <li>Afterwards, three requests to the controller fail</li>
  <li>In the end, after executing a new request to the "UserLogin"-function, also that fails.</li>
  </ol>
  
  <p>The response given to the client is the default "Error: Could not handle request". After waiting a few seconds, all requests get handled again as they are supposed to be.</p>
  
  <p>My best guesses:</p>
  
  <ul>
  <li>The project is on free tier, maybe google is throttling something? (I did not hit any limits afaik)</li>
  <li>Is there a limit of messages the google firebase console can handle?</li>
  <li>Could the tmpdir from the functions-app run low? I never delete the temporary files so far, but would expect that either google deletes them automatically, or warns me in a different way that the space is running low.</li>
  </ul>
  
  <p>Does someone know an alternative way to receive the error messages, or has experienced similar issues? (As Firebase Functions is still in Beta, it could also be an error from google)</p>
  
  <p>Btw: Downloading the image from the client (android app, react-native) directly is not possible, because I will use the function to check for access permissions later. The problem is reproducable for me.</p>