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.

How does sentry gets access to request body in the asgi middleware?

See original GitHub issue

Hello, I was reading through the asgi middleware and it’s not clear to me: how is the request data (i.e. the json payload of a POST request, for example) accessed to be sent by sentry, since all that’s accessible there is the scope, passing receive and send downstream?

Thank you!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
untitakercommented, Apr 12, 2021

Unfortunately I don’t think this is possible in a memory-efficient way. In framework integrations we can piggyback on the in-memory buffering of the framework itself but in a middleware we would have to wrap the bytestream and keep our own copy, which is expensive.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASGI - Sentry Documentation
Request data is attached to all events: HTTP method, URL, headers. Sentry excludes raw bodies and multipart file uploads. · Each request has...
Read more >
Problem accessing to the request body after configure Sentry ...
When the Sentry implementation is active, the body = await request.body() line hangs and never response. Additional Info. This answer has more ...
Read more >
Middleware - Starlette
The middleware above is the most basic ASGI middleware. It receives a parent ASGI application as an argument for its constructor, and implements...
Read more >
Advanced Middleware - FastAPI
Handles GZip responses for any request that includes "gzip" in the Accept-Encoding header. The middleware will handle both standard and streaming responses. ...
Read more >
tiangolo/fastapi - Gitter
Trying to enable the ASGI middleware.. and im not understanding the problem. ... while having a body in a get is discouraged, it's...
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