Camunda 8 Zebee Create Instance Command with result not catch errors

Hello,

We are using Camunda 8 zebee in our project. When we create a new instance from backend with CreateProcessInstance command (we are waiting response in this step with withresult method) .When our process instance throws an error, we expect the result to come immediately after receiving the error. But it waits until the timeout. This case we can see error detail in operate, but error not be thrown in NewCreateProcessInstanceCommand await. After a while we just catch grpc timeout. In this case we are waiting orginal error from camunda, isn’t it.

ps : we are using c#

Example :
Down you can see internal server error in operate :

but in backend error detail :
Status(StatusCode=“DeadlineExceeded”, Detail=“Time out between gateway and broker: Request ProtocolRequest{id=3104465, subject=command-api-1, sender=172.18.0.4:26502, payload=byte[]{length=653, hash=-741287975}} to 172.18.0.4:26501 timed out in PT20S”, DebugException=“Grpc.Core.Internal.CoreErrorDetailException: {“created”:”@1674562779.049000000",“description”:“Error received from peer ipv6:[::1]:26500”,“file”:"…\src\core\lib\surface\call.cc",“file_line”:1075,“grpc_message”:“Time out between gateway and broker: Request ProtocolRequest{id=3104465, subject=command-api-1, sender=172.18.0.4:26502, payload=byte[]{length=653, hash=-741287975}} to 172.18.0.4:26501 timed out in PT20S”,“grpc_status”:4}")

thnx for help

Hi @ozbekhan,

the withResult() method waits until the process instance is ended within the given timeout.

If something goes wrong during the process execution, the end event is not reached and no result can be returned. That’s why the timeout is reached.

Hope this helps, Ingo

Hi Ingo,

We wonder it, do you have any solution to catch exception in backend ?

Best Regards
Ă–zbekhan

Hi @ozbekhan,

because of the highly asynchronous characteristics, it is not possible as a caller to get more than just “command succeeded” or “command failed” response.

There is a construct to wait for the response in a synchronous fashion, that is described in this example: camunda-8-examples/synchronous-response-springboot at main · camunda-community-hub/camunda-8-examples · GitHub. It uses a unique task definition that a worker can wait until the specified task is reached.

It depends on your process, what should happen before the response is sent. In case of an error, you may use the error boundary event to send a different response.

Hope this helps, Ingo

1 Like

This is a longer form discussion of the problem with some other suggested approaches: How can I “create a process instance with result” *and* get information about exceptions in the process instance?