Flask-Restful: 405 method not allowed and other HTTP exceptions sent to server
See original GitHub issueWhen I use Flask-Restful in combination with the FlaskIntegration()
, the SDK will report 405 Method Not Allowed
and other HTTP-related exceptions to the server, even though we don’t intend to. This issue does not occur with Flask’s own MethodView
or the regular function-based routes.
I consider this a bug in Flask-Restful. This is just a tracking issue for https://github.com/flask-restful/flask-restful/issues/802.
The workaround for this is to filter out http exceptions like any other exception:
from werkzeug.exceptions import HTTPException
def before_send(event, hint):
if 'exc_info' in hint:
exc_type, exc_value, tb = hint['exc_info']
if isinstance(exc_value, HTTPException):
return None
return event
sentry_sdk.init(before_send=before_send)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Method Not Allowed flask error 405 - Stack Overflow
This is because you only allow POST requests when defining your route. When you visit /registrazione in your browser, it will do a...
Read more >How to Fix the HTTP 405 Method Not Allowed Error - Kinsta®
A 404 tells you that the requested URL couldn't be found or that it was entered incorrectly. A 405 error message, on the...
Read more >Avoiding the "405 Method Not Allowed" Error in Flask - YouTube
405 Method Not Allowed is a common error that beginners get while using Flask. In this video, I'll talk about why it happens...
Read more >How to Fix HTTP Error 405 Method Not Allowed - Hostinger
The 405 Method Not Allowed error occurs between a client and a server. This message indicates that the web server has recognized a...
Read more >405 Method Not Allowed: What It Is and How to Fix It
The user agent accidentally sent an incorrect HTTP method · The server is expecting only a handful of valid HTTP methods for the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m hesitant in marking this as wontfix, we should probably ship a workaround for this if many people are affected. Sadly this would mean that there’s no exact correlation between Flask’s own notion of “unhandled exception” and ours.
A simpler workaround