we have been developing a simple workflow as a POC (see attached image),
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.
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…
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.