title: How can I get the raw request body in a Google Cloud Function?
body: <p>I need the raw request body to be able to SHA-1 digest it to validate the Facebook webhook X-Hub-Signature header that's passed along with the request to my Firebase Function (running on Google Cloud Functions).</p>
  
  <p>The problem is that in cases like this (with a <code>Content-Type: application/json</code> header) GCF automatically parses the body using <code>bodyParser.json()</code> which consumes the data from the stream (meaning it cannot be consumed again down the Express middleware chain) and only provides the parsed javascript object as <code>req.body</code>. The raw request buffer is discarded.</p>
  
  <p>I have tried to provide an Express app to <code>functions.https.onRequest()</code>, but that seems to be run as a child app or something with the request body already being parsed, just like when you pass a plain request-response callback to <code>onRequest()</code>.</p>
  
  <p>Is there any way to disable GCF from parsing the body for me? Or could I somehow specify my own <code>verify</code> callback to <code>bodyParser.json()</code>? Or is there some other way?</p>
  
  <p>PS: I first contacted Firebase support about this a week ago, but for lack of a response there I'm trying it here now.</p>