Checking one of the environments of a cloud client, we found this error in the API logs of its master manager. After restarting the manager everything worked correctly again.
2021/05/18 06:35:21 ERROR: Error handling request
Traceback (most recent call last):
File "/var/ossec/framework/python/lib/python3.9/site-packages/connexion/apis/aiohttp_api.py", line 50, in problems_middleware
response = yield from handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 110, in impl
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/middlewares.py", line 139, in response_postprocessing
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/middlewares.py", line 31, in set_user_name
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/middlewares.py", line 114, in security_middleware
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/middlewares.py", line 87, in request_logging
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/middlewares.py", line 36, in set_secure_headers
resp = await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/aiohttp_cache/middleware.py", line 59, in cache_middleware
return await handler(request)
File "/var/ossec/framework/python/lib/python3.9/site-packages/connexion/decorators/coroutine_wrappers.py", line 23, in wrapper
connexion_response = yield from connexion_response
File "/var/ossec/framework/python/lib/python3.9/site-packages/api-4.1.5-py3.9.egg/api/controllers/cluster_controller.py", line 75, in get_cluster_nodes
nodes = raise_if_exc(await get_system_nodes())
File "/var/ossec/framework/python/lib/python3.9/site-packages/wazuh-4.1.5-py3.9.egg/wazuh/core/cluster/control.py", line 180, in get_system_nodes
result = await get_nodes(lc)
File "/var/ossec/framework/python/lib/python3.9/site-packages/wazuh-4.1.5-py3.9.egg/wazuh/core/cluster/control.py", line 52, in get_nodes
result = json.loads(await lc.execute(command=b'get_nodes',
File "/var/ossec/framework/python/lib/python3.9/json/__init__.py", line 359, in loads
return cls(**kw).decode(s)
File "/var/ossec/framework/python/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/var/ossec/framework/python/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>> import json
>>> json.loads(b'Error sending request: timeout expired.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Regards,
Víctor Fernández
API Error: json.loads cannot decode bytesarray
API Error: json.loads
does not receive a valid JSON
Jun 1, 2021