Skip to content
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

Python ASGI documentation causes errors in FastAPI #5272

Closed
minboost opened this issue Jul 9, 2022 · 5 comments
Closed

Python ASGI documentation causes errors in FastAPI #5272

minboost opened this issue Jul 9, 2022 · 5 comments
Labels
Team: Web Backend SDKs team-web-sdk-backend

Comments

@minboost
Copy link

minboost commented Jul 9, 2022

Core or SDK?

Platform/SDK

Which part? Which one?

https://docs.sentry.io/platforms/python/guides/asgi/

Description

Integrating with FastAPI with the following line throws various errors, depending on what is implemented

asgi_app = SentryAsgiMiddleware(asgi_app)

Some errors could include:

@app.middleware("http")
AttributeError: 'SentryAsgiMiddleware' object has no attribute 'middleware'
@app.on_event('shutdown')
AttributeError: 'SentryAsgiMiddleware' object has no attribute 'on_event'

Integrating the middleware as described in the FastAPI docs fixes the problem:

asgi_app.add_middleware(SentryAsgiMiddleware)

Suggested Solution

Update the documents with an example for FastAPI and/or a note that some ASGI middleware must be installed differently than shown in the example.

@getsentry-release
Copy link
Contributor

Routing to @getsentry/team-web-sdk-backend for triage. ⏲️

@vladanpaunovic
Copy link
Contributor

Hey @minboost, until now Sentry didn't have a native support for FastAPI so users had to use our ASGI integration.

Well, worry no more! 💪

This week, we will release a beta version of FastAPI integration and I recommend you give it a try and see whether it resolves this issue for you or not.

If curious, you can always check our FastAPI milestone for checking what will come up.

@kerenkhatiwada
Copy link
Member

Updated labels based on the above. If it's wrong please let me know!

@github-actions
Copy link
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@antonpirker
Copy link
Member

Documentation was updated.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Team: Web Backend SDKs team-web-sdk-backend
Projects
None yet
Development

No branches or pull requests

7 participants