Camunda 8 Task Service with HTTP Rest connector not working

Following is BPMN model service task code
<bpmn:serviceTask id=“task4” name=“Task4” zeebe:modelerTemplate=“io.camunda.connectors.HttpJson.v1.noAuth” zeebe:modelerTemplateIcon=“data:image/svg+xml;utf8,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%221%201%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.0335%208.99997C17.0335%2013.4475%2013.4281%2017.0529%208.98065%2017.0529C4.53316%2017.0529%200.927765%2013.4475%200.927765%208.99997C0.927765%204.55248%204.53316%200.947083%208.98065%200.947083C13.4281%200.947083%2017.0335%204.55248%2017.0335%208.99997Z%22%20fill%3D%22%23505562%22%2F%3E%0A%3Cpath%20d%3D%22M4.93126%2014.1571L6.78106%203.71471H10.1375C11.1917%203.71471%2011.9824%203.98323%2012.5095%204.52027C13.0465%205.04736%2013.315%205.73358%2013.315%206.57892C13.315%207.44414%2013.0714%208.15522%2012.5841%208.71215C12.1067%209.25913%2011.4553%209.63705%2010.6298%209.8459L12.0619%2014.1571H10.3315L9.03364%2010.0249H7.24351L6.51254%2014.1571H4.93126ZM7.49711%208.59281H9.24248C9.99832%208.59281%2010.5901%208.42374%2011.0177%208.08561C11.4553%207.73753%2011.6741%207.26513%2011.6741%206.66842C11.6741%206.19106%2011.5249%205.81811%2011.2265%205.54959C10.9282%205.27113%2010.4558%205.1319%209.80936%205.1319H8.10874L7.49711%208.59281Z%22%20fill%3D%22white%22%2F%3E%0A%3C%2Fsvg%3E%0A”>
bpmn:extensionElements
<zeebe:taskDefinition type=“io.camunda:http-json:1” />
zeebe:ioMapping
<zeebe:input source=“http://localhost:9090/v1/task4/start” target=“url” />
<zeebe:input source="{ “name”:“name”, “activity”:“activity” }" target=“body” />
<zeebe:input source=“post” target=“method” />
</zeebe:ioMapping>
zeebe:taskHeaders
<zeebe:header key=“resultVariable” value=“response” />
<zeebe:header key=“resultExpression” value="=name+" is running"" />
</zeebe:taskHeaders>
</bpmn:extensionElements>
bpmn:incomingFlow_19bsetp</bpmn:incoming>
bpmn:outgoingFlow_1jnmd9d</bpmn:outgoing>
</bpmn:serviceTask>

I have created local API at localhost:9090/v1/task4/start with Post method and I am using Camunda 8 SaaS platform to connect with operate API but Whenever process instance start it stucks at Rest service task.

Create Incident with following reason

Failed to invoke connector, received the following error: Connect to localhost:9090 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

Take a moment to think about where the REST call is running.

Since you’ve sent the work off to Zeebe SaaS, the REST call is originating on the Zeebe Cloud. Localhost is relative to where the worker is running, so it is going to try to connect to Zeebe Cloud on port 9090, which the Zeebe Team will logically block (they don’t have a service running there, so why would they allow connections)

If you want to make a call to your own REST interface, running on your own machine at port 9090, then the task worker would need to be working on your machine, or your REST interface would need to have a fully-qualified domain name and be exposed to the internet. (ie. Camunda Cloud would make a REST call to http://your.servername.example:9090 )

1 Like

You can use ngrok to put localhost on the Internet.

Josh

Yes, @GotnOGuts you are correct. But don’t you think that’s the issue as well that if I’m using Task Service as rest connector then I need to have working application (deployed on server). Have would any developer test it before that. Also in Self managed one Task service with HTTP rest connector not supported.

Yes - Connectors are not supported in Self-Managed yet.

You can test your API using ngrok, or deploy it to an Internet reachable VM in a cloud provider. Those are two popular ways to test with remote SaaS during development.

Josh

Yes I am trying with ngrok. But facing expression issue any documentation to understand http-connector expression used for response or variables

Here is the documentation for that: REST connector | Camunda Platform 8

Failed to evaluate expression ‘={ result:response.body.main}’

Any Explaination to this, I just need only body to be shown in this variable.

This really should be a different thread, with one of the above posts marked as a solution to your “unable to connect” issue.

The first question would ask on “Not able to parse response” would be: Is your response playload truly a JSON response, or is it something else?

1 Like

Yeah sure I’ll create another thread.