FAForever / downlords-faf-client

Official client for Forged Alliance Forever
https://faforever.com
MIT License
194 stars 117 forks source link

Replay filter returns invalid parameter #3115

Open obydog002 opened 5 months ago

obydog002 commented 5 months ago

Describe the bug Trying to search in the Player Name field on replays gives the exception. Client 2024.1.1 but I've seen this bug at least since the 2023.12.1 client.

To Reproduce Write something and search

Log or error message

com.faforever.commons.api.dto.ApiException: Invalid value: Combination of pagination, sorting over relationship and filtering over toMany relationships unsupported
    at com.faforever.client.api.FafApiAccessor.lambda$retrieveWithErrorHandling$20(FafApiAccessor.java:318)
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoOnErrorResume] :
    reactor.core.publisher.Mono.onErrorMap
    com.faforever.client.api.FafApiAccessor.lambda$retrieveWithErrorHandling$22(FafApiAccessor.java:318)
Error has been observed at the following site(s):
    *_______Mono.onErrorMap ⇢ at com.faforever.client.api.FafApiAccessor.lambda$retrieveWithErrorHandling$22(FafApiAccessor.java:318)
    |_                      ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec$StatusHandler.apply(DefaultWebClient.java:732)
    |_         Mono.flatMap ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.applyStatusHandlers(DefaultWebClient.java:687)
    |_   Mono.onErrorResume ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.applyStatusHandlers(DefaultWebClient.java:688)
    |_         Mono.flatMap ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.applyStatusHandlers(DefaultWebClient.java:693)
    |_           checkpoint ⇢ 400 BAD_REQUEST from GET https://api.faforever.com/data/game [DefaultWebClient]
    |_   Mono.switchIfEmpty ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.handleBodyMono(DefaultWebClient.java:656)
    |_                      ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.lambda$bodyToMono$2(DefaultWebClient.java:573)
    *_____________Mono.then ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient.releaseIfNotConsumed(DefaultWebClient.java:195)
    |_                      ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.lambda$applyStatusHandlers$18(DefaultWebClient.java:688)
    *__________Mono.flatMap ⇢ at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.bodyToMono(DefaultWebClient.java:572)
    |_       Mono.retryWhen ⇢ at com.faforever.client.api.FafApiAccessor.retrieveMonoWithErrorHandling(FafApiAccessor.java:292)
    |_       Mono.doOnError ⇢ at com.faforever.client.api.FafApiAccessor.retrieveMonoWithErrorHandling(FafApiAccessor.java:293)
    |_             Mono.map ⇢ at com.faforever.client.api.FafApiAccessor.getFromEndpointWithPageCount(FafApiAccessor.java:282)
    |_         Mono.flatMap ⇢ at com.faforever.client.api.FafApiAccessor.getFromEndpointWithPageCount(FafApiAccessor.java:283)
    |_   Mono.switchIfEmpty ⇢ at com.faforever.client.api.FafApiAccessor.getFromEndpointWithPageCount(FafApiAccessor.java:285)
    |_           Mono.cache ⇢ at com.faforever.client.api.FafApiAccessor.getFromEndpointWithPageCount(FafApiAccessor.java:286)
    |_        Mono.doOnNext ⇢ at com.faforever.client.api.FafApiAccessor.getFromEndpointWithPageCount(FafApiAccessor.java:287)
    |_                      ⇢ at com.faforever.client.api.FafApiAccessor.getManyWithPageCount(FafApiAccessor.java:276)
    |_             Mono.map ⇢ at com.faforever.client.replay.ReplayService.getReplayPage(ReplayService.java:466)
    *________Flux.concatMap ⇢ at reactor.util.retry.RetryBackoffSpec.lambda$generateCompanion$5(RetryBackoffSpec.java:545)
    |_     Flux.onErrorStop ⇢ at reactor.util.retry.RetryBackoffSpec.lambda$generateCompanion$5(RetryBackoffSpec.java:608)
    *__Flux.deferContextual ⇢ at reactor.util.retry.RetryBackoffSpec.generateCompanion(RetryBackoffSpec.java:543)
Original Stack Trace:
        at com.faforever.client.api.FafApiAccessor.lambda$retrieveWithErrorHandling$20(FafApiAccessor.java:318)
        at reactor.core.publisher.Mono.lambda$onErrorMap$27(Mono.java:3785)
        at reactor.core.publisher.Mono.lambda$onErrorResume$29(Mono.java:3875)
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:142)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
        at reactor.core.publisher.MonoReduce$ReduceSubscriber.onComplete(MonoReduce.java:197)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:152)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:152)
        at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onComplete(FluxPeekFuseable.java:277)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:152)
        at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)
        at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)
        at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)
        at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:780)
        at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)

Expected behavior Filtered replays to appear

Screenshots

cantSearch

OS Linux

obydog002 commented 5 months ago

Any ideas where to look so I can have a shot at fixing this for myself?

bukajsytlos commented 5 months ago

question is what do expect to be fix. in the end it is the limit of api framework translation of request to sql. so from client point of view, you can either prevent such a combination of filtering/sort or handle error in more meaningful way.

On Mon, 15 Jan 2024, 05:49 obydog002, @.***> wrote:

Any ideas where to look so I can have a shot at fixing this for myself?

— Reply to this email directly, view it on GitHub https://github.com/FAForever/downlords-faf-client/issues/3115#issuecomment-1891298008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBYJJPX4TOAV4EGGWFM77TYOSYOLAVCNFSM6AAAAABB2VS6LWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRGI4TQMBQHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Sheikah45 commented 5 months ago

The fix is to remove the illegal sorting option that doesn't work with filtering.

obydog002 commented 5 months ago

Ahh yes, the sort by option. I just didn't know how to use the filter panel We can close this then

Sheikah45 commented 5 months ago

Well there still shouldn't be a combo that results in an invalid request. I had thought I got all of them before

obydog002 commented 5 months ago

Sort by: Average Reviews score