title: How to handle Bad JSON in Firebase Cloud Functions?
body: <p>I'm creating a firebase application which uses firebase-cloud-functions.</p>
  
  <p>index.js</p>
  
  <pre><code>exports.auth = functions.https.onRequest((request, response) =&gt; {
    response.status(200).send({
      status : "Some Status"
    });
  }
  </code></pre>
  
  <p>This is very simple functions. I want to make a <code>POST</code> request on the endpoint with some payload. When I tested the API using Firebase Cloud Function Emulator and POSTman with <code>bad json</code></p>
  
  <pre><code>{
      "phoneNumber: "9632725300"
  }
  </code></pre>
  
  <p>The server just crashed! My question is how to handle the bad request in firebase functions like these. </p>
  
  <p>with this error
  <a href="https://i.stack.imgur.com/u8SGQ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/u8SGQ.jpg" alt="enter image description here"></a></p>