-
Notifications
You must be signed in to change notification settings - Fork 135
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
include_request_body not working for Flask #344
Comments
We just ran into the same issue. Looking at the implementation:
This doesn't contain the needed setting check. Simply adding it:
Fixes the issue. We'd appreciate this being updated! |
@moodh This is my temporal fix in case it's helpful for you: import os
import rollbar
import rollbar.contrib.flask
from flask import request, got_request_exception
@app.before_first_request
def init_rollbar():
"""Initialize Rollbar
"""
rollbar_environment = os.environ.get('ROLLBAR_ENVIRONMENT')
include_request_body = os.environ.get('ROLLBAR_INCLUDE_REQUEST_BODY')
if rollbar_environment in ('production', 'testing', 'demo'):
rollbar.init(
os.environ.get('ROLLBAR_ACCESS_TOKEN'),
rollbar_environment,
root=os.path.dirname(os.path.realpath(__file__)),
allow_logging_basic_config=False)
# Send exceptions from `app` to rollbar, using flask's signal system
if include_request_body:
got_request_exception.connect(rollbar.contrib.flask.report_exception, app)
else:
got_request_exception.connect(report_exc_without_body, app)
def report_exc_without_body(sender, exception, **extra):
# TODO: Temporal fix to avoid sending the body
# https://github.com/rollbar/pyrollbar/issues/344
rollbar.report_exc_info(request=request, payload_data={
'request': {'body': None}
}) |
Thanks, here's how I removed the data from our end, but I haven't fully tested it yet :)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you pass
include_request_body=False
(which is the default), Rollbar will still send the body.The text was updated successfully, but these errors were encountered: