FastAPI Integration - TypeError: 'coroutine' object is not callable
See original GitHub issueHow do you use Sentry?
Self-hosted/on-premise
Version
1.8.0
Steps to Reproduce
- Install the lib v1.8.0;
- Our Sentry server is self-hosted;
- Configure the sentry inicialization 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()
- So I did purposefully a request that would give me a 404/500 to activate the sentry warning.
Thanks in advance.
Expected Result
Sentry 404 log sent successfully.
Actual Result
web-1 | /usr/local/lib/python3.10/site-packages/sentry_sdk/serializer.py:216: RuntimeWarning: coroutine ‘request_validation_exception_handler’ was never awaited web-1 | with memo.memoize(obj) as result: web-1 | RuntimeWarning: Enable tracemalloc to get the object allocation traceback web-1 | ERROR: Exception in ASGI application web-1 | Traceback (most recent call last): web-1 | File “/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py”, line 403, in run_asgi web-1 | result = await app(self.scope, self.receive, self.send) web-1 | File “/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py”, line 78, in call web-1 | return await self.app(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/fastapi/applications.py”, line 269, in call web-1 | await super().call(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 268, in _sentry_patched_asgi_app web-1 | return await middleware(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 126, in _run_asgi3 web-1 | return await self._run_app(scope, lambda: self.app(scope, receive, send)) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 176, in _run_app web-1 | raise exc from None web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 171, in _run_app web-1 | return await callback() web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 268, in _sentry_patched_asgi_app web-1 | return await middleware(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 126, in _run_asgi3 web-1 | return await self._run_app(scope, lambda: self.app(scope, receive, send)) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 137, in _run_app web-1 | raise exc from None web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py”, line 134, in _run_app web-1 | return await callback() web-1 | File “/usr/local/lib/python3.10/site-packages/starlette/applications.py”, line 124, in call web-1 | await self.middleware_stack(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/fastapi.py”, line 122, in call web-1 | await self.app(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 461, in call web-1 | await self.app(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 86, in _create_span_call web-1 | await old_call(*args, **kwargs) web-1 | File “/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py”, line 184, in call web-1 | raise exc web-1 | File “/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py”, line 162, in call web-1 | await self.app(scope, receive, _send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 86, in _create_span_call web-1 | await old_call(*args, **kwargs) web-1 | File “/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py”, line 84, in call web-1 | await self.app(scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 160, in _sentry_exceptionmiddleware_call web-1 | await old_call(self, scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 160, in _sentry_exceptionmiddleware_call web-1 | await old_call(self, scope, receive, send) web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 160, in _sentry_exceptionmiddleware_call web-1 | await old_call(self, scope, receive, send) web-1 | [Previous line repeated 1 more time] web-1 | File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py”, line 86, in _create_span_call web-1 | await old_call(*args, **kwargs) web-1 | File “/usr/local/lib/python3.10/site-packages/starlette/exceptions.py”, line 104, in call web-1 | await response(scope, receive, sender) web-1 | TypeError: ‘coroutine’ object is not callable
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:7 (2 by maintainers)
Top GitHub Comments
@ybinnenwegin2ip Thanks for the project to reproduce this!
So there are two issues:
coroutine
error is raisedI have reproduced both problems but will not be able to fix them before the weekend. Will fix this beginning of next week.
Any progress on this? Edit: sorry, didn’t see the PR #1532 ! Great work!