Starlette/FastAPI: host-based routing raises AttributeError
#3506
Labels
bug
Something isn't working
AttributeError
#3506
Describe your environment
OS: macOS
Python version: 3.12.7
Package version: v0.51b0
What happened?
When instrumenting a FastAPI/Starlette app which uses Host-based routing (ref: https://www.starlette.io/routing/#host-based-routing), the instrument fails with the following error:
Steps to Reproduce
Create the following Starlette app:
Run it:
Make an HTTP request:
Expected Result
The request should be processed without error.
Actual Result
The request triggers an exception.
Additional context
A similar issue was reported and recently fixed on Sentry: getsentry/sentry-python#2631
The fix involved to fallback to the scope path when the path attribute was not directly available on the route object: https://github.com/getsentry/sentry-python/pull/4157/files
Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: