node:
v11.6.0
firebase-functions:
2.2.0
firebase-tools:
6.4.0
firebase-admin:
7.0.0
export const stripeWebhook = functions.https.onRequest((req, res) => {
const rawBody = req.rawBody;
}
Implement a http request handler function. Try to use req.rawBody.
I expect req.rawBody to exist, just like it is mentioned in the documentation (https://firebase.google.com/docs/functions/http-events).

I'm not able to deploy, because type Request ist missing property rawBody
Hey @davemaier, thanks for reporting this, and sorry to hear that you've been having trouble! This appears to be a documentation issue on our end. Firebase uses express Request and Response objects, and rawBody is a property that was removed from express.Request a couple versions ago. There are some good workarounds in that thread if you need this, but Request.rawBody is not available. I'm going to file a bug with our documentation to get rid of the lines that mention this outdated method.
Internal bug reference: 126210339
I have a https.onRequest cloud function just recently deployed that relies on rawBody, and it has been working fine.
If I'm not mistaken, the issue reported here deals with Typescript build errors preventing a deployment.
Is it possible that rawBody was added (maybe using one of the workarounds in the Express issue you link to) as part of firebase cloud functions?
Hey @wooliet and @davemaier, super sorry for the confusion. While rawBody was removed from express a while ago, Cloud Functions still provides it. I'm going to make a quick PR to add this property to our types so that it no longer gives Typescript users trouble.
Hi, big thanks to both of you for your support, saved me a lot of time.
@joehan I just wanted to mention that this problem also exists with the ESlint files when using the javascript, seems like they also don't contain the rawBody for the request type.
@davemaier Thanks for the heads up - I believe that the #420 should fix the problem with ESLint as well, but I'll double check. Regardless, this should be resolved next time firebase-functions releases :)
FYI, it looks like if you use functions.https.Request rawBody passes the TS compiler. However, if you use the alias functions.Request, the compiler does not find rawBody
Hi there, I am having an issue that only rawBody is available, not the rest of the properties (like query, params, body). Typescript issue here?
Hi there, I am having the same issue too. Only rawBody is available, not the rest of the properties (like query, params, body). Typescript issue here?
req.rawBody is referenced in Functions Documentation here: https://cloud.google.com/functions/docs/writing/http#multipart_data
I basically have the same code, except it's wrapped in Express, so I think it's erroring because it think it's still an Express Req instead of a Functions one.
I have tried using the Request directly from firebase-functions, however typescript doesn't seem to see a type - however it doesn't error!
Issue still persists. So how to compile typeascript when request.rawBody is missing?
Most helpful comment
FYI, it looks like if you use
functions.https.RequestrawBody passes the TS compiler. However, if you use the aliasfunctions.Request, the compiler does not find rawBody