You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was seen with kubernetes client calls returning failure status, this is no longer raising up correct error response/status etc. and is now failing with KeyError: 'content-length' (with 1.5.2 only, works fine with 1.5.1):
Seems like with f85ae1f, this issue was introduced. Do you have any suggestions on how to work around this? Any suggestions or helps would be highly appreciated.
{noformat}
Traceback (most recent call last):
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 521, in websocket_call
client = WSClient(configuration, url, headers, capture_all)
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 65, in init
self.sock = create_websocket(configuration, url, headers)
File ".venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 487, in create_websocket
websocket.connect(url, **connect_opt)
File "/.venv/lib/python3.9/site-packages/websocket/_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
File "/.venv/lib/python3.9/site-packages/websocket/_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
File "/.venv/lib/python3.9/site-packages/websocket/_handshake.py", line 147, in _get_resp_headers
response_body = sock.recv(int(resp_headers['content-length'])) # read the body of the HTTP error message response and include it in the exception
KeyError: 'content-length'
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 994, in connect_get_namespaced_pod_exec
return self.connect_get_namespaced_pod_exec_with_http_info(name, namespace, **kwargs) # noqa: E501
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 1101, in connect_get_namespaced_pod_exec_with_http_info
return self.api_client.call_api(
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
return self.__call_api(resource_path, method,
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
response_data = self.request(
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 527, in websocket_call
raise ApiException(status=0, reason=str(e))
kubernetes.client.exceptions.ApiException: (0)
Reason: 'content-length'
{noformat}
The text was updated successfully, but these errors were encountered:
I suspect the issue is that this line that was added to fix #900 response_body = sock.recv(int(resp_headers['content-length']))
and the HTTP message may not have a content-length header. Could you share the HTTP message, or at least the headers, of the message that is causing the issue? Wireshark may be useful to capture it. I did not realize this header might be optional, I'll have to check the HTTP specs.
This is a get call that I am expecting to fail with 403 forbidden error.
Here is the details header: {'audit-id': '<something>', 'cache-control': 'no-cache, private', 'content-type': 'application/json', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'date': 'Fri, 02 Jun 2023 01:25:36 GMT', 'transfer-encoding': 'chunked'} status: 403 message: Forbidden
This was seen with kubernetes client calls returning failure status, this is no longer raising up correct error response/status etc. and is now failing with KeyError: 'content-length' (with 1.5.2 only, works fine with 1.5.1):
Seems like with f85ae1f, this issue was introduced. Do you have any suggestions on how to work around this? Any suggestions or helps would be highly appreciated.
{noformat}
Traceback (most recent call last):
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 521, in websocket_call
client = WSClient(configuration, url, headers, capture_all)
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 65, in init
self.sock = create_websocket(configuration, url, headers)
File ".venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 487, in create_websocket
websocket.connect(url, **connect_opt)
File "/.venv/lib/python3.9/site-packages/websocket/_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
File "/.venv/lib/python3.9/site-packages/websocket/_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
File "/.venv/lib/python3.9/site-packages/websocket/_handshake.py", line 147, in _get_resp_headers
response_body = sock.recv(int(resp_headers['content-length'])) # read the body of the HTTP error message response and include it in the exception
KeyError: 'content-length'
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 994, in connect_get_namespaced_pod_exec
return self.connect_get_namespaced_pod_exec_with_http_info(name, namespace, **kwargs) # noqa: E501
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 1101, in connect_get_namespaced_pod_exec_with_http_info
return self.api_client.call_api(
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
return self.__call_api(resource_path, method,
File "/.venv/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
response_data = self.request(
File "/.venv/lib/python3.9/site-packages/kubernetes/stream/ws_client.py", line 527, in websocket_call
raise ApiException(status=0, reason=str(e))
kubernetes.client.exceptions.ApiException: (0)
Reason: 'content-length'
{noformat}
The text was updated successfully, but these errors were encountered: