0
votes

From past few days, i am getting the below error when i try to run the example python websocket flexible-app-engine application (https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/flexible/websockets). It use to work before but now when i run, i see the below error.

I dont see this issue when i run locally using - "gunicorn -b 127.0.0.1:8080 -k flask_sockets.worker main:app".

I see this issue only when i deploy in google cloud.

  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.

{
textPayload: "2021-05-14T22:33:23Z {'REMOTE_ADDR': '172.17.0.4', 'REMOTE_PORT': '23300', 'HTTP_HOST': 'malware-sandboxing.uc.r.appspot.com', (hidden keys: 39)} failed with WebsocketMismatch
"
insertId: "nn71n3jmo5u1ymw9s"
resource: {2}
timestamp: "2021-05-14T22:33:23Z"
labels: {4}
logName: "projects/malware-sandboxing/logs/appengine.googleapis.com%2Fstderr"
receiveTimestamp: "2021-05-14T22:33:26.911503907Z"
}

Please help

1

1 Answers

1
votes

Werkzeug released version 2.0.0 which also broke things for me.

https://github.com/pallets/werkzeug/releases/tag/2.0.0

Added Werkzeug==1.0.1 to the top of requirements file fixed my issue.