sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Sentry reporting anomalous ConnectionError in flask_sock

Open sanchay-hai opened this issue 1 year ago • 4 comments

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.29.2

Steps to Reproduce

This code should reproduce (I haven't tested)

from flask_sock import Sock
from flask import Flask
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

app = Flask(__name__)
socket = Sock(app)

@socket.route("/myroute")
def myroute(ws):
    while ws.connected:
       ws.receive()

sentry_sdk.init(dsn=<>, integrations=[FlaskIntegration()])

Expected Result

I think maybe sentry shouldn't report this error since socket handler is returning successfully from the application

Actual Result

After the socket successfully closes, sentry reports a ConnectionError from underlying flask_sock library. Here is the code from where that ConnectionError is raised: https://github.com/miguelgrinberg/flask-sock/blob/main/src/flask_sock/init.py#L86

We don't get any error on the console or logs, but sentry reports a ConnectionError. Not sure why?

sanchay-hai avatar Sep 12 '23 00:09 sanchay-hai