ClientDisconnect thrown from Starlette for FastApi Integration
See original GitHub issueHow do you use Sentry?
Sentry Saas (sentry.io)
Version
1.9.0
Steps to Reproduce
- Install the lib v1.9.0;
- Configure the sentry initialization as described in the release documentation:
from fastapi import FastAPI
from sentry_sdk.integrations.starlette import StarletteIntegration
from sentry_sdk.integrations.fastapi import FastApiIntegration
sentry_sdk.init(
dsn="...",
integrations=[
StarletteIntegration(),
FastApiIntegration()
],
)
app = FastAPI()
Originally my application (which is running on Rancher k8s, behind an nginx ingress controller) has a SentryAsgiMiddleware instrumented and function normally. However, when I switch to use the new beta FastApiIntegration()
, my application can start but would throw errors for all requests.
Strangely though, this setup would work locally when I am using localhost.
Expected Result
My FastAPI server instance should function normally. Messages and errors should be captured and sent to my Sentry SAAS instance.
Actual Result
The server hangs up on request to the server. An ClientDisconnect
Error is thrown and received by Sentry.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
FastAPI and Starlette Sentry Integrations Have Arrived
FastAPI is known for building REST APIs, middleware services, and simple integration for adding authentications and more.
Read more >RuntimeError: No response returned in FastAPI when refresh ...
After checking the code I found that starlette BaseHTTPMiddleware.__call__ method is throwing this error when the client disconnects the ...
Read more >tiangolo/fastapi - Gitter
It's handled in a middleware. E.g. from fastapi import FastAPI, Depends from starlette.responses import JSONResponse app = FastAPI() class ...
Read more >Third Party Packages - Starlette
Check out how to integrate with Starlette. ... A simple tool for integrating Starlette and WTForms. ... FastAPI style routing for Starlette.
Read more >Developing a Single Page App with FastAPI and Vue.js
Along with the apps themselves, you'll add authentication and integrate them together. It's assumed that you have experience with FastAPI, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@antonpirker We have tried to use #1532. It seems like the head of that branch has indeed fixed the issue! Here are some screenshots for the result:
We have also double checked that the released v1.9.0 version of the library is not working, as we have previously depicted when we opened the issue.
After a few trials, we settled with v1.9.3 and it is running live on production. We are still in the progress of instrumenting our frontend repository but everything is looking good on the Python side right now!