Handling Http-Connector errors (technical error)

I have found that not all HTTP error codes are handled as a technical error for camunda… i.e a 404. Would the javascript below be an accurate approach to handle these codes so that if a 404 Camunda will create an incident ?

var statusCode = connector.getVariable(“statusCode”);
var headers = connector.getVariable(“headers”);

if (statusCode !== 200) {
throw new Error('Http-Connector error: ’ + statusCode + ’ - ’ + headers)
}
else {
S(response, ‘application/json’).data;
}

1 Like

Hi Neil,

Could you explain further what do you want to achieve?

Best regards,
Yana

This is a workaround for handling the Service Task with HTTP Connector with JavaScript no response.
Try to change the endpoint of service to force the error handling.
test-service.bpmn (11.3 KB)

1 Like

Here is the no workaroud way to resolve with Error Boudary Event:

if (statusCode != 200) {
    throw new org.camunda.bpm.engine.delegate.BpmnError("error-boundary-no-respose");
} else {
    S(response);
}


test-service-error-boundary-event.bpmn (9.2 KB)

1 Like

I am facing the same issues. It seems none of the error codes are handled for http-connector. This should be mention in the documentation. Isn’t there any proper way to do so apart from workaround?

Regards,
Hetal

1 Like

This is not working. We have tested this process and its giving error - HTCL-02007 Unable to execute HTTP request. Do you have any other method/approach/process for reference.

1 Like

This does work for when you have a HTTP response (404, 400…) but when the server is unresponsive (failed connection) you get “HTCL-02007 Unable to execute HTTP request”.

Is there a way to overcome the non-response situation?

Best Regards

2 Likes

We have replaced connector activity with java delegate and invoked interface using camunda httpConnector. We had put try and catch block to raise exception.

3 Likes

Yes it is a big mess and apparently not a big priority to be fixed. There is a 4-year-old thread discussing the topics.

Apparently, the built-in function to access external resources is not a priority.

Maybe the new $100M funding means they can finally fix it.

Not holding my breath… ;(

@GChester1 Is absolutely right, we’ve never really prioritized fundamentally fixing the connectors. they do have a lot of draw back.

But I can tell you that at the moment we are in fact spending some time looking through all the issues and trying to work out how to move forward with Connectors. It’s pretty early still but we understand the frustration this feature can cause so there is going to something done to try to alleviate the problems somehow.

All i can say is stay tuned.

Hi
I have bpmn flow with http connector.


I implemented retry mechanism inside the error handler with java delegete (return to last task)

I want to throw exception when the service is unavailable
How do I add to the http connector this kind of exception?

1 Like

Hey @chani ,

here is a project where @Niall and I explain how to make REST-calls from Camunda and how http response codes can be handled in different implementations (including connectors): https://github.com/camunda-community-hub/Make-Rest-Calls-From-Camunda-Example

If you are already using Java Delegates it might be a better idea to implement the REST call as well within a Java Delegate instead of using the Connector.

Cheers
Nele

2 Likes