Skip to content
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

Flask_Sockets is incompatible with Flask 2 causing Python server to fail #14

Closed
priyankark opened this issue May 29, 2021 · 4 comments
Closed
Labels
dependencies Pull requests that update a dependency file

Comments

@priyankark
Copy link
Owner

User reported getting the following issue:

Traceback (most recent call last): File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\gevent\pywsgi.py", line 999, in handle_one_response self.run_application() File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\geventwebsocket\handler.py", line 75, in run_application self.run_websocket() File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\geventwebsocket\handler.py", line 52, in run_websocket list(self.application(self.environ, lambda s, h, e=None: [])) File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\flask\app.py", line 2088, in __call__ return self.wsgi_app(environ, start_response) File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\flask_sockets.py", line 40, in __call__ handler, values = adapter.match() File "C:\Users\MasterS\AppData\Roaming\Python\Python39\site-packages\werkzeug\routing.py", line 2030, in match raise WebsocketMismatch() werkzeug.routing.WebsocketMismatch: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. 2021-05-28T20:45:50Z {'REMOTE_ADDR': '192.168.0.14', 'REMOTE_PORT': '43050', 'HTTP_HOST': '192.168.0.4:5000', (hidden keys: 26)} failed with WebsocketMismatch

@priyankark
Copy link
Owner Author

@priyankark priyankark added the dependencies Pull requests that update a dependency file label May 29, 2021
Repository owner deleted a comment from github-actions bot May 30, 2021
@priyankark
Copy link
Owner Author

Please use a version < 2 until this issue is fixed. Will close this issue once the root issue gets fixed.
You can also consider using the Node server instead.

@priyankark
Copy link
Owner Author

Fix for now: clone the repo.
pip uninstall flask #Uninstalls flask 2.x
pip install -r requirements.txt #force installs flask 1.1.4

The original issue needs to be fixed by the Flask_Socket team.

@rajeshr6r
Copy link

For me adding markupsafe along with downgrading Flask to 1.1.4 worked .

Flask==1.1.4
Flask-Sockets==0.2.1
google-cloud-speech==2.0.1
markupsafe==2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants