RemoteDisconnected Error when using requests.patch on Eve endpoint

4/26/2018

I'm trying to track down a frustrating error with my Eve application. I am trying to update a record, but whenever I send the patch request, I am greeted with the following error:

 File "/home/undivided/.local/lib/python3.6/site-packages/requests/api.py", line 140, in patch
return request('patch', url, data=data, **kwargs)
 File "/home/undivided/.local/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/home/undivided/.local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/undivided/.local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/undivided/.local/lib/python3.6/site-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

The request is being made like this:

res = requests.patch(
    url,
    json=mydata,
    headers={
        "If-Match": _etag,
        "Authorization": 'Bearer {}'.format(eve_token)
    }
)

The strange thing is, that all other request types to the same instance, including a GET to the exact same record, return properly. There are no errors that I can see in the Eve logs either.

The only possible complicating factor I can think of is that the eve application is deployed on a kubernetes cluster, but, as I said, all of the GETs/POSTs I have tried work as expected.

EDIT:

To add a further complicating factor, when I exec into my pod and try the request there, it succeeds, so it seems the problem is related to Kubernetes? Do I need to do something to enable HTTP PATCH on Kubernetes?

-- mstorkson
eve
http
kubernetes
python
python-requests

0 Answers