Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Endpoints EOFException

I have the method below in AppEngine:

@ApiMethod(name = "authed", path = "greeting/authed")
public HelloGreeting authedGreeting(User user) {
    ...
}

My doInBackground method in Android AsyncTask:

HelloGreeting hg = null;
try {
    hg = service.authed().execute();
} catch (IOException e) {
    Log.d("error", e.getMessage(), e);
}
return hg;

I encountered the ff error:

/_ah/api/.../v1/greeting/authed: java.io.EOFException

In logcat:

Problem accessing /_ah/api/.../v1/greeting/authed. Reason: INTERNAL_SERVER_ERROR
    at java.util.zip.GZIPInputStream.readUByte
    at java.util.zip.GZIPInputStream.readUShort
    at java.util.zip.GZIPInputStream.readUShort

It only work when calling non-auth method. How to fix it?

Im using the local server.

like image 315
JR Galia Avatar asked Dec 20 '13 02:12

JR Galia


1 Answers

I was running into a similar problem with when making a call for inserting values. Mine differs slightly because I am not using authentication, however I was getting the same exception. I am using appengine-java-sdk-1.8.8. I was able to make other endpoint calls having this error. I looked at the generated code and the difference that I saw with the working calls versus the non-working calls, was the HttpMethod. The failing call was defined as "POST". I was able to change this using the annotation attribute httpMethod=ApiMethod.HttpMethod.GET in the @ApiMethod annotation.

@ApiMethod(httpMethod = ApiMethod.HttpMethod.GET, name = "insertUserArtist", path = "insertUserArtist")

I then regenerated the client code and I was able to make the call without getting the dreaded EOFException. I am not sure why POST doesn't work properly but changing it to GET worked. This does possibly present some questions on how much data can be sent across and should be addressed (possibly a library issue). I am going to look into creating a demonstration app to submit to Google.

like image 131
Alex Beggs Avatar answered Oct 07 '22 08:10

Alex Beggs