WebSocketMismatch error on Python GAE Flexible

898 views
Skip to first unread message

Giulio Gialanella

unread,
May 17, 2021, 9:16:55 AM5/17/21
to Google App Engine
Hi all,
I'm working on a python application with WebSockets and AppEngine Flexible.
I did my latest deployment on the 11th may and it's working.

Yesterday I tried to deploy again with exactly the same code and now I'm getting this error:

Traceback (most recent call last): File "/env/lib/python3.6/site-packages/gevent/pywsgi.py", line 999, in handle_one_response self.run_application() File "/env/lib/python3.6/site-packages/geventwebsocket/handler.py", line 75, in run_application self.run_websocket() File "/env/lib/python3.6/site-packages/geventwebsocket/handler.py", line 52, in run_websocket list(self.application(self.environ, lambda s, h, e=None: [])) File "/env/lib/python3.6/site-packages/flask/app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "/env/lib/python3.6/site-packages/flask_sockets.py", line 40, in __call__ handler, values = adapter.match() File "/env/lib/python3.6/site-packages/werkzeug/routing.py", line 2026, in match raise WebsocketMismatch() werkzeug.routing.WebsocketMismatch: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.

I also found another user who had a similar problem 2 days ago: https://serverfault.com/questions/1063604/websockets-flexible-app-engine

This leads me to think it's caused by some change in the App Engine Environment.
Does anyone have some insight?

Elliott (Cloud Platform Support)

unread,
May 17, 2021, 5:47:49 PM5/17/21
to Google App Engine

Hello,

I understand that you are receiving an error when you are deploying an application in App Engine Flex that uses web sockets.

I was able to find a common issue describing the exact one you have that was being worked on by the App Engine Specialists two days ago. They have indicated that the issue has been addressed but I see that it is still affecting you. To verify, I used the documentation here to see if I may deploy the code and was successful in doing so.

So I may ask you to monitor this issue for two days to allow the changes to be replicated and if you still have that same issue after that time, I invite you to reply to this thread and we will provide additional instructions.

Giulio Gialanella

unread,
May 18, 2021, 11:14:47 AM5/18/21
to Google App Engine

Hi Elliot,

thanks for the response, it's good to know that the problem has been already aknowledged.
To be clearer, the issue does not arise during the deploy, but only when a call is made to the application to open a webSocket.

babdelrahman

unread,
May 28, 2021, 3:37:59 PM5/28/21
to Google App Engine
Hello, 

- Please try updating the dependencies of your application.

- I could see that it's related to the Werkzeug libraries when the version is >1.0.2. Adding the following line to the requirements.txt file resolves the issue:
Werkzeug==1.0.1

Kindly update us with your findings.

Giulio Gialanella

unread,
Jun 1, 2021, 11:58:19 AM6/1/21
to Google App Engine
Hi,
I changed Flask version from 1.1.2 to 1.1.4 and now it's working.
Reply all
Reply to author
Forward
0 new messages