title: Firebase Function returning connection error
body: <p>I am using firebase functions Database Triggers.</p>
  
  <p>My Function :</p>
  
  <pre><code>exports.function_name = functions.database
    .ref("/transact/{entry_type}/{id1}/{id2}/trigger_cross_entry_function")
    .onCreate((data, context) =&gt; {
      console.log("trigger_cross_entry_function value", data.val());
  
      if (data.val() == true) {
  
        console.log("Function Calling parent data");
  
        return data.ref.parent.once('value').then(function(snapshot){
  
  
        }, function(error) {
          // The Promise was rejected.
          console.error("THIS IS THE ERROR:"+error);
        });
  
      } else {
        console.log("Function Returned");
        return 0;
      }
   });
  </code></pre>
  
  <p>Whenever I want to trigger this function I put trigger_cross_entry_function into that partcular path from the Mobile App. Everything works fine and function is called as expected.</p>
  
  <p>After sometime If I again try to do the same thing it gives me </p>
  
  <p><code>Function execution took 16 ms, finished with status: 'connection error'</code> </p>
  
  <p>If I restart the function than it again works perfectly.
  and If I trigger it continously than it has no issue.</p>
  
  <p>But once I keep it idle and try to trigger it
  again after sometime, it gives me this error.</p>
  
  <p>And I am using Firebase Pay as you go Plan.</p>
  
  <p>Also, as you can see I am returning all the promises correctly and function is being triggered everytime but It doesnt go into the function. it just exit with connection error.</p>
  
  <p>What might be the cause for this ? I have a spent a day finding this.</p>