WebSocket handshake error in bokeh on deploying on kubernetes?

5/25/2020

I have developed a app using bokeh and running it using bokeh serve app.py.

The app is running fine on local, but when I deploy it on prod (kubernetes), it shows following errors:

On application log

400 GET /app/ws (100.110.109.133) 0.46ms

On Browser console

bokeh.min.js?v=57d29d5936e494351385d736f792154c:551 WebSocket connection to 'ws://***/app/ws' failed: Error during WebSocket handshake: Unexpected response code: 400

bokeh.min.js?v=57d29d5936e494351385d736f792154c:551 [bokeh] Failed to connect to Bokeh server: Could not open websocket

xqTrUSbsN4huCcddNcjrkVZtk46inlGUacd44jX5kzED: Error: Could not open websocket

enter image description here

How to debug the cause of issue? I think something is not right in k8 infra, some header is blocked or nginx config is the issue but how to debug the cause?

-- FlapPy
bokeh
kubernetes
nginx
websocket

1 Answer

5/25/2020

How to debug the cause of issue?

Since you have a working setup, just compare two sets of headers for the ws requests - one from the working setup and one from the not working one. Find the missing headers or headers with seemingly wrong values and try to find out why they're missing or being replaced.

-- Eugene Pakhomov
Source: StackOverflow