Flask-MonitoringDashboard icon indicating copy to clipboard operation
Flask-MonitoringDashboard copied to clipboard

Installing this dashboard breaks app with Flask-ScoketIO

Open amks1 opened this issue 3 years ago • 1 comments

Describe the bug Installing flask-monitoringdashboard breaks my app which uses Flask-SocketIO. Trying to use websockets produces the following traceback:

127.0.0.1 - - [01/Aug/2021 20:30:29] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 500 -
Traceback (most recent call last):
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\flask\app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\flask_socketio\__init__.py", line 45, in __call__
    return super(_SocketIOMiddleware, self).__call__(environ,
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\engineio\middleware.py", line 60, in __call__
    return self.engineio_app.handle_request(environ, start_response)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\socketio\server.py", line 573, in handle_request
    return self.eio.handle_request(environ, start_response)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\engineio\server.py", line 379, in handle_request
    r = self._handle_connect(environ, start_response,
", line 554, in _handle_connect
    ret = s.handle_get_request(environ, start_response)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\engineio\socket.py", line 103, in handle_get_request
    return getattr(self, '_upgrade_' + transport)(environ,
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\engineio\socket.py", line 158, in _upgrade_websocket
    return ws(environ, start_response)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\engineio\async_dri    self.ws = Server(environ)
  File "C:\Users\fmc\Documents\GitHub\fmc-Console\.venv\Lib\site-packages\simple_websocket\ws.py", line 138, in __init__
    raise RuntimeError('Cannot obtain socket from WSGI environment.')
RuntimeError: Cannot obtain socket from WSGI environment.

To Reproduce Steps to reproduce the behavior:

  1. You must have a Flask-SocketIO app with a frontend to send data to.
  2. pip install flask_monitoringdashboard
  3. Now as soon as you go to any route that has a socket connection, you'll get the above error.

Likely cause:

You will notice the following lines during pip install flask_monitoringdashboard:

Installing collected packages: Werkzeug, tzlocal, jinja2, itsdangerous, greenlet, click, sqlalchemy, 
scipy, psutil, flask, configparser, colorhash, apscheduler, flask-monitoringdashboard
  Attempting uninstall: Werkzeug
    Found existing installation: Werkzeug 2.0.1
    Uninstalling Werkzeug-2.0.1:
      Successfully uninstalled Werkzeug-2.0.1
  Attempting uninstall: jinja2
    Found existing installation: Jinja2 3.0.1
    Uninstalling Jinja2-3.0.1:
      Successfully uninstalled Jinja2-3.0.1
  Attempting uninstall: itsdangerous
    Found existing installation: itsdangerous 2.0.1
    Uninstalling itsdangerous-2.0.1:
      Successfully uninstalled itsdangerous-2.0.1
    Uninstalling click-8.0.1:
      Successfully uninstalled click-8.0.1
  Attempting uninstall: flask
    Found existing installation: Flask 2.0.1
    Uninstalling Flask-2.0.1:
      Successfully uninstalled Flask-2.0.1
Successfully installed Werkzeug-1.0.1 apscheduler-3.7.0 click-7.1.2 colorhash-1.0.3 configparser-5.0.2 flask-1.1.4 flask-monitoringdashboard-3.1.0 greenlet-1.1.0 itsdangerous-1.1.0 jinja2-2.11.1 psutil-5.8.0 scipy-1.7.0 sqlalchemy-1.4.22 tzlocal-2.1

So essentially it's downgrading a lot of my packages, and it's quite likely that this is what's causing the issue.

amks1 avatar Aug 01 '21 16:08 amks1

Hi @amks1, thank you for bringing up this issue and taking the time to contribute to the Flask-MonitoringDashboard project.

As part of my school project, my team is conducting a usability research study to improve the dashboard. I noticed your experience with the app and thought it would be valuable to gather more insights from you.

Would you be open to receiving a few questions about your experience with Flask-MonitoringDashboard? It won't take more than 20 minutes to answer them. Your feedback will play a vital role in enhancing the app's functionality and addressing any existing limitations.

If you're interested, please let me know, and I will send you the questions. Your involvement would be highly valuable and greatly appreciated.

HrisyToteva avatar Jul 14 '23 08:07 HrisyToteva