Error handling when using http-connector

Hi, I am a beginner in camunda and I have an issue using “Error Boundary Events” and catching errors. I try to use http-connector in service tasks to make a rest calls.
The problem is when I try to follow those examples where people suggest using scripts to throw org.camunda.bpm.engine.delegate.BpmnError(“SomeErrorCode”) (like here: Handling Http-Connector errors (technical error) - #3 by mbitencourt), it doesn’t catch that error and I can’t redirect the process. It just stops at this service task as an incident with “rest call fail, code - 404” message.
I also tried making a conditional boundary event with a script, which checks if the status code is != 200 and redirect the process but it doesn’t work and the job keeps failing with the same message. I tried to set “Async before” property and “Retry Time Cycle”, but it doesn’t help much in case the endpoint in http-connector is not available (which happens sometimes in our project). My goal is to redirect (or catch) the process when http-connector is failed to call specified URL. Does someone know how to fix this?

I’m running into something similar. When I start the flow with a message event (through the REST API) and the second step is an HTTP call (using the connector) to an offline service strange things happen:

When the service task doesn’t have an event boundary the API call fails with a ‘HTCL-02007 Unable to execute HTTP request’ response instead of a 204.

When there is an event boundary, an incident is created, but on the message start event, not on the service task.

How is this suppose to work? Expected behaviour would be that the http-connector returns statusCode 500 and we can trap that. Now I’m a bit at a loss :frowning:

I run the Camunda 7.19 platform on a Java Spring Boot application.

Hi, we actually have solved our problem already. The problem was that we had our own implementation of http-connector (extending class ServiceTaskConnectorActivityBehavior does it). We forced it to create incident every time when exception happens (like 500- and 400- codes, the service we trying to call is unavailable, etc.) and there was no way we can use “error boundary events” to catch any errors and re-route them in order to handle any exception. Clearly it was our mistake to do it like that.

So, i am not sure about your problem, maybe check if there any additional custom logic in your service tasks or you have your own implementation/configuration of handling incidents.

@safich Thanks for replying and great to hear you’ve solved your issue!

Today I’ve read on more than one occasion to steer clear from the camunda-connect-http-client or shouldn’t I @Niall ?

Writing our own implementation might do the trick, but will read and watch some material on this subject first e.g.

Turns out it’s all in the ‘Asynchronous continuations’ settings of the steps.

1 Like