title: onCall function in Firebase Functions results in Unhandled Rejection Error in Firebase Function Logs
body: <p>By following the Firebase Docs and Stripe API Docs, I have created a function that creates a charge from a token that is passed. This function is setup with Firebases onCall function to be able to call it directly from my app. </p>
  
  <p>Sadly, when you call the function, Stripe returns an error, though the function doesn't seem to send that to the client as my client thinks it was a success.</p>
  
  <p><strong>Firebase Function in index.ts</strong></p>
  
  <pre><code>export const oneTimeCharge = functions.https.onCall((data, context) =&gt; {
    stripe.charges.create({
      amount: data.amount,
      currency: data.currency,
      source: data.source,
      description: data.description
    }).then((charge) =&gt; {
      return {'charge':charge};
    }).catch((error) =&gt; {
      throw new functions.https.HttpsError('unknown', 'Something went wrong!', error);
    })
  });
  </code></pre>
  
  <p>When I call this function, the Firebase Functions Logs show the two following errors. This leads me to believe that my <strong>functions.https.HttpsError</strong> is not correct.</p>
  
  <p><strong>Error 1</strong></p>
  
  <pre><code>Unhandled rejection
  </code></pre>
  
  <p><strong>Error 2</strong></p>
  
  <pre><code>Error: Something went wrong!
  at stripe.charges.create.then.catch (/srv/lib/index.js:37:15)
  at &lt;anonymous&gt;
  at process._tickDomainCallback (internal/process/next_tick.js:229:7)
  </code></pre>
  
  <p>and my service function in Angular returns it as a success. What am I missing or doing wrong? I feel like I've googled for hours.</p>