JsonEncodingException in Tasklist java client

Hi, facing the below exception while calling tasklist java client methods like getAllTasks, claimTask.

com.apollographql.apollo3.exception.JsonEncodingException: Use JsonReader.setLenient(true) to accept malformed JSON at path
at com.apollographql.apollo3.api.json.BufferedSourceJsonReader.syntaxError(BufferedSourceJsonReader.kt:945)
at com.apollographql.apollo3.api.json.BufferedSourceJsonReader.checkLenient(BufferedSourceJsonReader.kt:861)
at com.apollographql.apollo3.api.json.BufferedSourceJsonReader.doPeek(BufferedSourceJsonReader.kt:296)
at com.apollographql.apollo3.api.json.BufferedSourceJsonReader.beginObject(BufferedSourceJsonReader.kt:98)
at com.apollographql.apollo3.api.internal.ResponseParser.parse(ResponseParser.kt:26)
at com.apollographql.apollo3.api.Operations.parseJsonResponse(Operations.kt:59)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$1$response$2.invoke(HttpNetworkTransport.kt:106)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$1$response$2.invoke(HttpNetworkTransport.kt:105)
at com.apollographql.apollo3.internal.NonMainWorker.doWork(NonMainWorker.kt:5)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$invokeSuspend$$inlined$map$1$2.emit(Collect.kt:151)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$2.collect(SafeCollector.common.kt:113)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$invokeSuspend$$inlined$map$1.collect(SafeCollector.common.kt:114)
at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(Collect.kt:109)
at kotlinx.coroutines.flow.FlowKt.emitAll(Unknown Source)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invokeSuspend(HttpNetworkTransport.kt:87)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(HttpNetworkTransport.kt)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(HttpNetworkTransport.kt)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(ChannelFlow.kt)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Hi @Amrutha_Motamarry,

there are two enviroment variables missing in the kubernetes configuration/Helm charts:

SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI and SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWKSETURI have to be set.

They are already used in the latest version of the helm chart. You check this commit for further details about the value: https://github.com/camunda/camunda-platform-helm/pull/416/files#diff-4ab25ebb0376b41c4ca40463f88dfbf228b65722faca806429880f0237272c22

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

Thanks for your quick response. I have updated the helm with latest version with two variables included. However, facing 401 unauthorized exception as below:

io.camunda.tasklist.exception.TaskListException: com.apollographql.apollo3.exception.ApolloHttpException: Http request failed with status code 401
at io.camunda.tasklist.CamundaTaskListClient.execute(CamundaTaskListClient.java:138)
at io.camunda.tasklist.CamundaTaskListClient.getTasks(CamundaTaskListClient.java:116)
at io.camunda.tasklist.CamundaTaskListClient.getTasks(CamundaTaskListClient.java:62)
at io.camunda.tasklist.CamundaTaskListClient.getTasks(CamundaTaskListClient.java:57)
Caused by: com.apollographql.apollo3.exception.ApolloHttpException: Http request failed with status code 401
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invokeSuspend(HttpNetworkTransport.kt:71)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(HttpNetworkTransport.kt)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(HttpNetworkTransport.kt)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(ChannelFlow.kt)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

I’m utilizing SelfManagedAuthentication provided by Camunda to create tasklist client. Without the above variables, client is authenticating but facing jsonEncodingException as mentioned in previous post. After including the variables, client is not authenticating as shown above.

It would be helpful if you could state any configurations that I’m missing. Thanks in advance.

1 Like