Skip to content

fix(starlette,fastapi)!: Stop eagerly consuming request bodies - #7487

Merged
alexander-alderman-webb merged 5 commits into
major/3.0from
webb/starlette/eager-request-body
Sep 14, 2026
Merged

alexander-alderman-webb merged 5 commits into
major/3.0from
webb/starlette/eager-request-body

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Read the request body in the event processor body and only rely on cached attributes.

The code to read the request body in StarletteRequestExtractor.extract_request_info() now mirrors _get_cached_request_body_attribute(), which is used to get the request for streamed spans.

Issues

Closes #7285
Closes #4827
Closes #4764

Reminders

@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner September 14, 2026 07:11
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as draft September 14, 2026 07:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 830db2f. Configure here.

Comment thread sentry_sdk/integrations/starlette.py
@alexander-alderman-webb alexander-alderman-webb changed the title fix(starlette): Stop eagerly consuming request bodies fix(starlette,fastapi): Stop eagerly consuming request bodies Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

66169 passed | ⏭️ 3292 skipped | Total: 69461 | Pass Rate: 95.26% | Execution Time: 207m 34s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -65991
Passed Tests 📉 -62152
Failed Tests
Skipped Tests 📉 -3839

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2261 uncovered lines.
❌ Project coverage is 89.49%. Comparing base (9a5e80e) to head (ac553cd).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/starlette.py 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.17%    89.49%    -0.68%
==========================================
  Files          193       180       -13
  Lines        25768     21514     -4254
  Branches      9532      7814     -1718
==========================================
+ Hits         23236     19253     -3983
- Misses        2532      2261      -271
- Partials      1432      1223      -209

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review September 14, 2026 07:54
@alexander-alderman-webb alexander-alderman-webb changed the title fix(starlette,fastapi): Stop eagerly consuming request bodies fix(starlette,fastapi)!: Stop eagerly consuming request bodies Sep 14, 2026
@alexander-alderman-webb
alexander-alderman-webb merged commit 4d2663e into major/3.0 Sep 14, 2026
148 of 149 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/starlette/eager-request-body branch September 14, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants