Job throwError variables do not appear in state in error handler

Hi,

we have been developing a simple workflow as a POC (see attached image),
Screenshot from 2023-09-27 15-42-19

we are trying to set a variable using the job.error API call which uses the throwError gRPC call,
similar to

Blockquote

job.error({
errorCode: ‘RECORD_NOT_FOUND’,
errorMessage: ‘Could not find the customer in the database’,
variables: {
someVariable: ‘someValue’
}
})

Blockquote

we wish to use the exclusive gateway to either wait for an intermediate event message catch,
or simply end the workflow.

The BPM flow works in general, however the specific variable does not appear in the state in the worker task after the boundary error event.

We have debugged the nodejs client and it seems that the variables are indeed sent to the broker
with a gRPC call. Furthermore, we have updated your client and zeebe versions to the latest (8.2.5 and 8.2.13 respectively) to ensure that the API supports variables in the throwError call.

We are currently not sure if this is due to misconfiguration or we are not using the API call correctly.

Any support/help would be greatly appreciated.

Thanks in advance,

Is your API Call

job.error({
errorCode: ‘RECORD_NOT_FOUND’,
errorMessage: ‘Could not find the customer in the database’,
variables: {
someVariable: ‘someValue’
}
})

or

job.error({
errorCode: "RECORD_NOT_FOUND",
errorMessage: "Could not find the customer in the database",
variables: "{
someVariable: \"someValue\"
}"
})

The API Guide shows that the variable is to be a String containing the JSON object…

Hi @GotnOGuts,

thank you for your answer.

the nodejs client code is with a json object as specified in the documentation

The nodejs zeebe client does in fact transform the variables payload to a string (in our case
variables: ‘{“somevar”:“blah”}’ before the gPRC call, so I do not believe this is the problem.

I have in fact tried what you suggest, and it actually results in an error.

We suspect that the problem happens in the broker most likely, checking the Elasticsearch event database, the event is logged there and the variable is present as well.

       "customHeaders" : { },
        "variables" : {
          "somevar" : "blah"
        },
        "deadline" : 1695851054748,

Found the problem myself, after some further investigation.

Seems that there needs to be a variable mapping in the catch event definition

in order for this variable to be present in the process state as well, the error variables
are not automatically included.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.