question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property req.rawBody is missing

See original GitHub issue

Related issues

[REQUIRED] Version info

node:

v11.6.0

firebase-functions:

2.2.0

firebase-tools:

6.4.0

firebase-admin:

7.0.0

[REQUIRED] Test case

export const stripeWebhook = functions.https.onRequest((req, res) => {

    const rawBody = req.rawBody;

}

[REQUIRED] Steps to reproduce

Implement a http request handler function. Try to use req.rawBody.

[REQUIRED] Expected behavior

I expect req.rawBody to exist, just like it is mentioned in the documentation (https://firebase.google.com/docs/functions/http-events).

[REQUIRED] Actual behavior

image

Were you able to successfully deploy your functions?

I’m not able to deploy, because type Request ist missing property rawBody

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
deremercommented, Jun 11, 2019

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

2reactions
jasonho-lynxcommented, Jan 15, 2021

This answer here fixed it for me (it’s @mitchellbutler’s mention of this issue on Apr 21 2020, just a few comments up from here): https://github.com/stripe/stripe-node/issues/341#issuecomment-617193575

The main line being: const firebaseRequest = req as https.Request which types it as functions.https.Request, enabling access to rawBody. Also reference @deremer’s comment above: https://github.com/firebase/firebase-functions/issues/417#issuecomment-500657318

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express missing properties when using typescript: rawBody
My temporary fix is to use the as keyword to tell the compiler to consider the req object as another type when you...
Read more >
raw-body - npm
Gets the entire buffer of a stream either as a Buffer or a string. Validates the stream's length against an expected length and...
Read more >
Create dynamic responses with templating request helpers
The full request's raw body can also be fetched when the path is omitted ( {{body}} ) independently ... 1, string, Default value...
Read more >
Request - Fastify
Request is a core Fastify object containing the following fields: ... performance reason on not found route, you may see that we will...
Read more >
Controllers | Ts.ED - A Node.js and TypeScript Framework on ...
Raw Body v6.20.0+. RawBodyParams decorator provides you quick access to the request.rawBody : import ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found