You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a sample application with Flask 2.1.2 like this:
fromflaskimportFlaskimportsentry_sdkfromsentry_sdk.integrations.flaskimportFlaskIntegrationsentry_sdk.init(
dsn="https://d767560f70c3498ba64a91a16d987514@o447951.ingest.sentry.io/6483053",
integrations=[FlaskIntegration()],
debug=True,
# Set traces_sample_rate to 1.0 to capture 100%# of transactions for performance monitoring.# We recommend adjusting this value in production.# traces_sample_rate=1.0
)
app=Flask(__name__)
@app.route("/")defhello_world():
return"<p>Hello, World!</p>"@app.route('/debug-sentry')deftrigger_error():
division_by_zero=1/0return"<p>bla</p>"
put this in hello.py and start with FLASK_APP=hello flask run.
Expected Result
The errors should be caught and sent to Sentry.
Actual Result
There is a BadRequest Error during processing of the Error. (But the error is still sent to Sentry, but this BadRequest should not be there):
[sentry] ERROR: Internal error in sentry_sdk
Traceback (most recent call last):
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/flask/wrappers.py", line 128, in on_json_loading_failed
return super().on_json_loading_failed(e)
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/werkzeug/wrappers/request.py", line 611, in on_json_loading_failed
raise BadRequest(
werkzeug.exceptions.BadRequest: 400 Bad Request: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/sentry_sdk/integrations/flask.py", line 192, in inner
FlaskRequestExtractor(request).extract_into_event(event)
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 72, in extract_into_event
parsed_body = self.parsed_body()
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 121, in parsed_body
return self.json()
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/sentry_sdk/integrations/flask.py", line 172, in json
return self.request.get_json()
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/werkzeug/wrappers/request.py", line 571, in get_json
return self.on_json_loading_failed(None)
File "/Users/antonpirker/tmp/flask/.venv/lib/python3.9/site-packages/flask/wrappers.py", line 133, in on_json_loading_failed
raise BadRequest() from e
werkzeug.exceptions.BadRequest: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
[sentry] INFO: Discarded session update because of missing release
When you downgrade some of the requirements of Flask, it works:
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.5.12
Steps to Reproduce
See also internal ticket here: https://getsentry.atlassian.net/jira/software/c/projects/WEBBACKEND/boards/150?modal=detail&selectedIssue=ISSUE-1506&quickFilter=260
Create a sample application with Flask 2.1.2 like this:
put this in
hello.py
and start withFLASK_APP=hello flask run
.Expected Result
The errors should be caught and sent to Sentry.
Actual Result
There is a BadRequest Error during processing of the Error. (But the error is still sent to Sentry, but this BadRequest should not be there):
When you downgrade some of the requirements of Flask, it works:
The text was updated successfully, but these errors were encountered: