◐ Shell
clean mode source ↗

fix(fastapi): use effective_route_context path for prefixed routers by ericapisani · Pull Request #6572 · getsentry/sentry-python

The fix handles the case where FastAPI >= 0.137 stores the
prefix-resolved path in scope["fastapi"]["effective_route_context"] instead of scope["route"].path, so transactions/segments now show the full /api/users/{user_id} path instead of the unprefixed
/users/{user_id}.

Additionally, in the case of the `strawberry` framework without a specified path, this would fallback to using `generic FastAPI request` instead of using the prefix provided in the router (like `graphql` in the test cases.

Fixes PY-2530
Fixes #6571

cursor[bot]

Bot reviewed Jun 15, 2026

alexander-alderman-webb

@ericapisani ericapisani deleted the py-2530-fastapi-strawberry-tox-fix branch

June 15, 2026 15:14