PATCH request Unexpected EOF read on the socket


I’m trying to route a PATCH request through a channel. This channel has a route to a spring RestController:

public class PatchResource {

    Logger logger = LoggerFactory.getLogger(getClass());

    @PatchMapping(path = "/")
    public ResponseEntity patch(@RequestBody Map<String, Object> propertyValues) {"{}", propertyValues);
        return ResponseEntity.ok().body(propertyValues);

When calling the endpoint directly, it returns the expected response:

$ docker exec -it openhim-core curl -X PATCH -H "Content-Type:application/json" -d '{"hello":"world"}' http://patch-test:8080/

When calling through OpenHIM,

docker exec -it openhim-core curl -X PATCH -H "Content-Type:application/json" -d '{"hello":"world"}' http://localhost:5001/patch-test

the request fails on the endpoint with the following error:

openhim-patch-test-1 | 2024-01-08 08:41:08.811 WARN 1 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is Unexpected EOF read on the socket

Increasing the channel timeout does not solve the issue.

Using core v8.4.0 on docker.


1 Like

@richard.langford @gloria.makeleni @chris could you help with guidance on this?


I get similar results with this mediator:

app.all("*", (_req, res) => {
    if(!_req.body) {
      res.status(400).json({error: "No request body"});

Hi, I have tried this out myself and I get the same error. It seems this is a bug in the OpenHIM. Please could you capture this and a issue on Github and I’ll see that is addressed.

Sorry for the delayed response.

1 Like


Here is the GitHub issue: Missing request body in PATCH requests · Issue #1217 · jembi/openhim-core-js · GitHub