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

fix: fix Django ASGI integration on Python 3.12 #3027

Merged
merged 3 commits into from Apr 30, 2024

Conversation

bellini666
Copy link
Contributor

Upgrading a Django ASGI application to Python 3.12 broke because of the integration not being able to identify that the middleware being called was async.

This is due to Python 3.12 replacing setting _is_coroutine = asyncio.coroutines._is_coroutine with inspect.markcoroutinefunction

This ports the fix from asgiref to make sure sentry_sdk can support multiple python versions.

I thought about importing it from asgiref, but not sure how the maintainers feel about requiring it as a dependency (although it is already a django's dependency)

@sentrivana
Copy link
Contributor

Hey @bellini666, thanks a lot for the fix! Taking a look.

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I also think porting the asgiref shim is a good way to go about this, even if asgiref is a Django dependency.

Thanks again for the fix, will merge this now.

@sentrivana sentrivana added the Trigger: tests using secrets PR code is safe; run CI label Apr 30, 2024
@sentrivana sentrivana enabled auto-merge (squash) April 30, 2024 12:01
@sentrivana sentrivana merged commit fb1b746 into getsentry:master Apr 30, 2024
109 of 111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Trigger: tests using secrets PR code is safe; run CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants