Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.0.1
Steps to Reproduce
Environment info:
django=5.0.4
djangorestframework=3.15.1
- Add sentry integration to django app:
if ENV != "development":
sentry_sdk.init(
dsn="https://....ingest.sentry.io/6010199",
integrations=[
DjangoIntegration(
transaction_style="url",
middleware_spans=True,
signals_spans=True,
cache_spans=False,
)
],
debug=DEBUG, # This is true in this case
send_default_pii=True,
environment=ENV,
)
- `logger.exception("This is an exception")
- See traceback
Expected Result
Either the exception is successfully logged to Sentry, or it's not sent to Sentry at all since it's a log entry and not an unhandled exception.
Actual Result
# Traceback for the `logger.exception` call goes here
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/django/__init__.py", line 555, in parsed_body
return self.request.data
^^^^^^^^^^^^^^^^^
AttributeError: 'ASGIRequest' object has no attribute 'data'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/django/asgi.py", line 56, in asgi_request_event_processor
DjangoRequestExtractor(request).extract_into_event(event)
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 96, in extract_into_event
parsed_body = self.parsed_body()
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/django/__init__.py", line 557, in parsed_body
return RequestExtractor.parsed_body(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 142, in parsed_body
return self.json()
^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 154, in json
raw_data = self.raw_data()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/django/__init__.py", line 538, in raw_data
return self.request.body
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/http/request.py", line 328, in body
raise RawPostDataException(
django.http.request.RawPostDataException: You cannot access body after reading from request's data stream
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status
Activity