Skip to content

JSONDecodeError Expecting value: line 1 column 1 (char 0) (StarletteIntegration) #1550

@MrSalman333

Description

@MrSalman333

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.9.2

Steps to Reproduce

after using the new integration we got this error some times ,, not always

 [2022-08-07 14:47:40 +0300] [11] [ERROR] Exception in ASGI application
 Traceback (most recent call last):
   File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
     result = await app(self.scope, self.receive, self.send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
     return await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 269, in __call__
     await super().__call__(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 287, 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 126, 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 176, in _run_app
     raise exc from None
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/asgi.py", line 171, 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 98, in _create_span_call
     await old_call(*args, **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 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 68, in __call__
     response = await self.dispatch_func(request, call_next)
   File "/app/commons/main.py", line 52, in add_release_tag_custom_header
     response = await call_next(request)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 46, in call_next
     raise app_exc
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 36, in coro
     await self.app(scope, request.receive, send_stream.send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/scout_apm/async_/starlette.py", line 73, in __call__
     raise exc
   File "/usr/local/lib/python3.10/site-packages/scout_apm/async_/starlette.py", line 70, in __call__
     await self.app(scope, receive, wrapped_send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 84, in __call__
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/trustedhost.py", line 34, in __call__
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
     return await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
     await responder(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 43, in __call__
     await self.app(scope, receive, self.send_with_gzip)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 189, in _sentry_exceptionmiddleware_call
     await old_call(self, scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 189, in _sentry_exceptionmiddleware_call
     await old_call(self, scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 189, in _sentry_exceptionmiddleware_call
     await old_call(self, scope, receive, send)
   [Previous line repeated 4 more times]
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/starlette/exceptions.py", line 93, in __call__
     raise exc
   File "/usr/local/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__
     await self.app(scope, receive, sender)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 98, in _create_span_call
     await old_call(*args, **kwargs)
   File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
     raise e
   File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 670, in __call__
     await route.handle(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 266, in handle
     await self.app(scope, receive, send)
   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 65, in app
     response = await func(request)
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/fastapi.py", line 77, in _sentry_app
     info = await extractor.extract_request_info()
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 449, in extract_request_info
     parsed_body = await self.parsed_body()
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 524, in parsed_body
     json_data = await self.json()
   File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/starlette.py", line 503, in json
     return await self.request.json()
   File "/usr/local/lib/python3.10/site-packages/starlette/requests.py", line 242, in json
     self._json = json.loads(body)
   File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
     return _default_decoder.decode(s)
   File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
     raise JSONDecodeError("Expecting value", s, err.value) from None
 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Expected Result

not causing an error

Actual Result

causing errors instead of reporting them >_<

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions