sentry-kubernetes icon indicating copy to clipboard operation
sentry-kubernetes copied to clipboard

ValueError: Invalid value for `involved_object`, must not be `None`

Open strongpauly opened this issue 5 years ago • 2 comments

Getting this error from a deployed pod:

2019-12-19 13:42:24,350 Unhandled exception occurred.
Traceback (most recent call last):
  File "./sentry-kubernetes.py", line 66, in main
    watch_loop()
  File "./sentry-kubernetes.py", line 107, in watch_loop
    for event in stream:
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 131, in stream
    yield self.unmarshal_event(line, return_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 84, in unmarshal_event
    js['object'] = self._api_client.deserialize(obj, return_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 236, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 276, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 622, in __deserialize_model
    instance = klass(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/models/v1_event.py", line 107, in __init__
    self.involved_object = involved_object
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/models/v1_event.py", line 266, in involved_object
    raise ValueError("Invalid value for `involved_object`, must not be `None`")
ValueError: Invalid value for `involved_object`, must not be `None`

Kubernetes is EKS on AWS.

kubectl version:

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T14:25:20Z", GoVersion:"go1.12.7", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.12-eks-c500e1", GitCommit:"c500e11584c323151d6ab17526d1ed7461e45b0c", GitTreeState:"clean", BuildDate:"2019-10-22T03:11:52Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}

strongpauly avatar Dec 19 '19 13:12 strongpauly

I believe this is because of an incompatibility of the kubernetes client library being used. https://github.com/kubernetes-client/python#compatibility-matrix

@strongpauly Could you try changing the version of the kuberentes client in the requirements.py file so that it matches your server version. Since your server is version 1.13 I think you should be using client-python 9.0.

I've been seeing the same error sporadically after using client-python 10.0 with a 1.13 server. It seems that this error may cause the pod to restart, but at some point it stay up but reports no events to sentry. Deleting the pod and having a new one come up fixes the problem for me.

Jonnymcc avatar Jan 13 '20 16:01 Jonnymcc

I am getting the same issue

2022-08-18 13:50:48,490 Unhandled exception occurred.
Traceback (most recent call last):
  File "./sentry-kubernetes.py", line 66, in main
    watch_loop()
  File "./sentry-kubernetes.py", line 107, in watch_loop
    for event in stream:
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 131, in stream
    yield self.unmarshal_event(line, return_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 84, in unmarshal_event
    js['object'] = self._api_client.deserialize(obj, return_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 236, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 276, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 622, in __deserialize_model
    instance = klass(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/models/v1_event.py", line 107, in __init__
    self.involved_object = involved_object
  File "/usr/local/lib/python3.7/site-packages/kubernetes/client/models/v1_event.py", line 266, in involved_object
    raise ValueError("Invalid value for `involved_object`, must not be `None`")
ValueError: Invalid value for `involved_object`, must not be `None`

Versions

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:04:16Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}

grigoryevandrey avatar Aug 18 '22 14:08 grigoryevandrey

Hey, Thanks for reporting! The agent is being rewritten in Go now, so we'll just close this one.

tonyo avatar Nov 28 '23 14:11 tonyo