FAForever/faf-java-api

Sorting by ID on the Mods page throws a 500 error code.

Closed this issue · 9 comments

java.util.concurrent.CompletionException: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error: [{"requestId":"2c443ae2-ca86-4d92-8364-59dd14fc8e6d","errors":[{"status":"500","title":"java.lang.NullPointerException"}]}]
at org.springframework.aop.interceptor.AsyncExecutionAspectSupport.lambda$doSubmit$3(AsyncExecutionAspectSupport.java:279)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error: [{"requestId":"2c443ae2-ca86-4d92-8364-59dd14fc8e6d","errors":[{"status":"500","title":"java.lang.NullPointerException"}]}]
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:186)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:125)
at com.faforever.client.api.JsonApiErrorHandler.handleError(JsonApiErrorHandler.java:31)
at org.springframework.security.oauth2.client.http.OAuth2ErrorHandler.handleError(OAuth2ErrorHandler.java:89)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740)
at org.springframework.security.oauth2.client.OAuth2RestTemplate.doExecute(OAuth2RestTemplate.java:132)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:315)
at com.faforever.client.api.FafApiAccessorImpl.getPageWithMeta(FafApiAccessorImpl.java:652)
at com.faforever.client.api.FafApiAccessorImpl.findModsByQueryWithMeta(FafApiAccessorImpl.java:418)
at jdk.internal.reflect.GeneratedMethodAccessor241.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
at com.sun.proxy.$Proxy69.findModsByQueryWithMeta(Unknown Source)
at com.faforever.client.remote.FafService.findModsByQueryWithPageCount(FafService.java:452)
at com.faforever.client.remote.FafService$$FastClassBySpringCGLIB$$6c91c77e.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at org.springframework.aop.interceptor.AsyncExecutionAspectSupport.lambda$doSubmit$3(AsyncExecutionAspectSupport.java:276)
... 4 more

@Brutus5000 500 error is maybe an API bug?

@SpicerXD can you include a screenshot of the query you made to cause the error? Also if you enclose the error message in tripple backticks it will look better:

```
Error message here
```

Hmm I can reproduce in the client, but it's not a general issue, as this manual query works: https://api.faforever.com/data/mod?sort=id&filter=displayName==%22*Total*%22

Ok I debugged on the client and the breaking issue is this: https://api.faforever.com/data/mod?sort=-latestVersion.id
It's not really sorting by id of the map, but by id of the last map version.

Not sure why this is causing a 500. Maybe we have some inconsistent maps that have no latest mapVersion.

workaround for now should be downgrade to hibernate 5.3.(15)

I'm not sure downgrading is a feasible option in Spring Boot, and honestly I don't trust the Hibernate project to fix the issue any time soon and then we are stuck with the old version forever.

Should be fixed in upcoming hibernate 5.5.0

Solved in v2.9.5