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

Starlette "send_patched" broken #1701

Closed
woidda opened this issue Oct 21, 2022 · 3 comments
Closed

Starlette "send_patched" broken #1701

woidda opened this issue Oct 21, 2022 · 3 comments
Assignees
Labels

Comments

@woidda
Copy link

woidda commented Oct 21, 2022

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.10.0

Steps to Reproduce

Seems that patching in starlette introduced an error: AttributeError: 'functools.partial' object has no attribute '__name__'

Stacktrace:

 [2022-10-21 13:16:36 +0000] [22] [ERROR] Error in ASGI Framework
 Traceback (most recent call last):
   File "/usr/local/lib/python3.10/site-packages/hypercorn/asyncio/task_group.py", line 23, in _handle
     await app(scope, receive, send, sync_spawn, call_soon)
   File "/usr/local/lib/python3.10/site-packages/hypercorn/app_wrappers.py", line 33, in __call__
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 270, in __call__
     await super().__call__(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 322, in _sentry_patched_asgi_app
     return await middleware(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py", line 139, in _run_asgi3
     return await self._run_app(scope, lambda: self.app(scope, receive, send))
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py", line 188, in _run_app
     raise exc from None
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py", line 183, in _run_app
     return await callback()
   File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
     await self.middleware_stack(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 127, in _create_span_call
     await old_call(app, scope, new_receive, new_send, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
     raise exc
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
     await self.app(scope, receive, _send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 127, in _create_span_call
     await old_call(app, scope, new_receive, new_send, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 92, in __call__
     await self.simple_response(scope, receive, send, request_headers=headers)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 147, in simple_response
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 124, in _create_span_call
     send_patched = send.__name__ == "_sentry_send"
 AttributeError: 'functools.partial' object has no attribute '__name__'

Note: a downgrade to 1.9.10 solves the problem

Expected Result

no 500 error

Actual Result

500 error

@antonpirker
Copy link
Member

A bug fix version was released: https://github.com/getsentry/sentry-python/releases/tag/1.10.1

Please test with the new version and tell me if it is working!

@woidda
Copy link
Author

woidda commented Oct 21, 2022

You guess you mean this fix? I will test on Monday as it is not often a good idea to release on Friday unless you have to...

@woidda
Copy link
Author

woidda commented Oct 25, 2022

Fixed with 1.10.1

@woidda woidda closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants