-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sentry_sdk.capture_message()
does nothing within a FastAPI route
#2451
Comments
Hey @jarednieder, thanks for the report! I can't repro this, I get both messages in Sentry. Could you init the SDK with
You should see this at least for the module level message. |
@sentrivana here is the full debug trace:
There are two |
@jarednieder Thanks! Looks like the SDK is sending both messages, so it must be getting dropped somewhere further down the line. Stupid question, but you've ruled out filters in Sentry being responsible for the second message not popping up (e.g. the issue was marked as resolved at some point and is thus not showing up as a new issue)? I don't off the top of my head see any reason why the message should be getting dropped, it's definitely not crossing any size bounds. |
@sentrivana It turns out that this isn't a stupid question at all. There was an Inbound Data Filter that was filtering out all localhost traffic. Disabling this allowed me to test locally 🤦 Thanks a bunch for helping me debug this and apologies for the oversight on my side. |
@jarednieder No worries! Happy that it's working now. 👍🏻 |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.32.0
Steps to Reproduce
I'm working with a FastAPI application and when I attempt to call
sentry_sdk.capture_message()
from within a request context, nothing is logged in Sentry.Here is a minimal app to reproduce the issue:
Running the previous snippet with
SENTRY_DSN=XYZ uvicorn app:app
, I notice the following:TEST MESSAGE
will appear in Sentry when the app startshttp://localhost:8000/
), the second message (TEST MESSAGE (IN ROUTE)
) does not appear in Sentry.I observe that the second message will appear if I set
auto_enabling_integrations=False
when initializingsentry_sdk
, however I would prefer to gain the benefits of the FastAPI integration.Below is the output from
pip freeze --all
:Expected Result
I expect to receive a message,
TEST MESSAGE (IN ROUTE)
, in Sentry when a user navigates tohttp://localhost:8000/
Actual Result
No message appears in Sentry when a user navigates to
http://localhost:8000/
The text was updated successfully, but these errors were encountered: