Nullpointer exception while reading request.data or request.getBody().bytes
The-Neo-Noir opened this issue · comments
I was trying to run webery on google cloudrun, I experience the NullPointerException while reading the request.data for post methods.
hello, can you please provide more information? can you reproduce it locally? is it multipart-post?
The same thing works fine in locally and a docker container as well. However once it goes into cloud run it fails.
It's not a multipart post , just a json data post.
public SubmissionControllerRest() {
post((JsonResponseHandler) (request, response) -> {
System.out.println("Starting to retrieve data"+request.data()); // request.data() is null,
}});
private interface JsonResponseHandler extends Handler {
Object process(Request request, Response response);
default Response handle(Request request, Response response) throws IOException {
return response
.setBody(JsonTools.serializeToBytes(process(request, response)))
.appendHeader(Header.KV_CONTENT_TYPE_APPLICATION_JSON)
.appendHeader("Access-Control-Allow-Origin", request.header(Header.KEY_ORIGIN, "*"));
}
}
I have excluded code that's failing further down in the lambda process method. I am pretty sure it's something to do with the Google CloudRun environment. But could not figure out why. By the way the get requests are working fine. So I assume the epoll is not the problem.
I am on 0.4 version of http
I changed to http server instead of the web server and the problem seems to be gone. Closing this issue