-
Notifications
You must be signed in to change notification settings - Fork 548
Make sure everything works with Django-Rest-Framework #24
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
Comments
RawPostDataException
You cannot access body after reading from request's data stream Way how you read request body kill Django-Stripe integration |
I'm sorry, I can't reproduce this issue. Could you open a new issue, with a traceback? |
It's somewhat difficult to understand why using sentry with django_rest_framework does not upload request bodies out of the box. There were a few scattered SO and github threads about the problem but the few that I found refer to the older sentry client. I managed to track down the problem and wanted to share my results.
Here are relevant parts of the code that I found: https://github.com/encode/django-rest-framework/blob/3.9.0/rest_framework/parsers.py#L68 https://github.com/django/django/blob/2.1.5/django/http/request.py#L283 One workaround is to do something silly like this:
I put up a repo demonstrating this. https://github.com/cwmoo740/django_sentry_debugging It would be significantly better imo if there was a separate integration for DjangoRestFramework that simply read from request.data directly and let DRF do the parsing, as you suggested when you opened this thread. If that work will be accepted I can tackle it and put up a pr. |
Hi, I've also faced this issue when using DRF 3.9.0 and sentry-sdk 0.7.8 (0.7.4 also has this). With new unified sdk request bodies aren't sent to Sentry UI. I was able to track it down to the place where issue occurs. When extracting data from request, sdk tries to get body here, but it's impossible due to the |
@cwmoo740 I'm very sorry I dropped the ball on this. Your investigation is very complete and I will fix this in the next release. I think the primary confusion for me was that |
0.7.10 was released which should fix this |
This is happening on 2.0.1 |
Uh oh!
There was an error while loading. Please reload this page.
We should django-rest-framework's
request.data
instead of trying to extract a structured body ourselvesThe text was updated successfully, but these errors were encountered: