Tasklist GraphQL API returning error

Hello,
when running a simple GraphQL query (using the nestJS example found on github) I’m getting this error in return

“Error getting tasks The field at path ‘/tasks[0]/taskState’ was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is ‘TaskState’ within parent type ‘Task’”

I’m not getting if it’s due to some values in the returned Tasks array or if I wrongly configured the query myself.
If it’s the value of a task that doesn’t have a taskState, how could I bypass this element or modify it’s content through Operate or anything else ?

Best regards

I’ve found out that if I delete all the tasks via Operate, then my query works fine returning me all the old tasks that I can’t even see in Operate anymore.

As soon as there’s a new task I’m able to see in the list with the state: CREATED

After a couple of minutes, executing again the same query, I receive the error I posted in my previous message.
That’s a really odd behaviour.
It’s like if something modifies the state variable of the running process to the null value but my BPMN is quite simple, with no timer or boundary event, and no intervention by a user.

Can it be that usertask jobs that have timed out will get to a state = null ?
It’s the only explanation I can give to the behaviour I’m seeing.

If that’s the case, how can I avoid it apart from setting an infinite timeout to the worker listening for “io.camunda.zeebe:userTask” jobs ?

Got the same problem here, if there’s any progress, please post here, thank you

While waiting for an answer from a Camunda member, I’m using a worker timeout way in the future but when that timeout will fire for the first time, the entire GraphQL API will be unusable because it fails when encountering the first task with a state = null.

zbc.createWorker({
      taskType: 'io.camunda.zeebe:userTask',
      timeout: Duration.days.of(365),
      taskHandler: this.engineService.sendUserTaskJobWorker,
      longPoll: Duration.minutes.of(2)
    });

The other related issue is that I can’t really remove for good the tasks.
I can still see all the COMPLETED tasks even if I removed the process instances via Operate.
Most probably they are still in the ElasticSearch but I don’t know how to delete them

Hi @mfmanca!

I’m trying to understand and reproduce the error that you mentioned, so can you help me to get there?

What I’m doing is to follow the steps of this tutorial, is it the same that you mentioned? Any further step?

Thanks.

What my code does, apart from creating a worker to listen to the taskType “io.camunda.zeebe:userTask”, is forwarding this kind of jobs (job.forward()) whenever a job is received from a worker.
You should see straight away the behaviour when doing the simple queries you find in the tutorial you pointed out, just repeat the query every 15 seconds until you’ll get the error.
I’m using a Self Managed Camunda instance via Docker-compose (right now I cannot tell you the exact version number because I don’t have access to my usual PC)

Thanks @mfmanca, if you could check the version that would be helpful as well.

If you still have the instance or still can reproduce, are you seeing something like this on the tasklist logs?

TaskState {taskState} not supported

@mfmanca - I talked with @marcosgvieira today, and we followed up with the engineering teams. The good news is that we were able to reproduce the issue; the bad news is that I don’t have a workaround or an ETA for the fix currently. As soon as we’ve got some more detail, we will circle back and share it with you!

It’s already great that you’ve been able to reproduce it. We’ll wait for your fix and in the meantime I’m using the workaround I’ve posted in a previous message that is to say setting a timeout way far in the future.
Thanks a lot

Hi @marcosgvieira can you please tell me clearly how to delete a task in camunda platform.

Hey @Madan_Kumar, there is no functionality to delete tasks from Tasklist APIs (Graph or REST), once the task is created you can complete it if you want to remove it from pending tasks.

Yah, Thankyou @marcosgvieira I have removed the unwanted tasks from deployments there I have direct option to remove a task :sweat_smile:

And one more please I need some resources or guidance for connecting Camunda with python and I have to start any simple process with python code Please help in this case

As this topic originally was about GraphQL API, I recommend that you open a new topic just to not mix the subjects if you have any extra questions :slight_smile: , but I recommend that you have a look here for the python topic: Python Script / Connecting Python with Camunda - #4 by Nele

1 Like

@mfmanca just to inform that we have a fix for this issue aimed for our next patch release 8.2.6 (early June), thanks for helping in the triage and investigation and I hope that the fix improves your solution so you can remove the workaround. I will update here again once the release is done and the fix is available.

Thank you! We’ll wait for this version then. Have a nice day