Getting 400 Bad Request while calling fetchAndLock method

Hi there,
I’m facing issue while calling fetchAndLock method, getting 400 Bad Request. Here I have the Camunda Engine running as one service and External Task Client is running as another service. Now I want to fetch the external tasks that are there in the camunda engine.
Camunda Engine Base URL : https://design-studio/process/workbench/engine-rest
If I try to get the external tasks from postman I’m getting response as status 200 OK.
If I try to get the same from External Task Client I’m getting 400 bad request.

Below is the requests I’m trying

PostMan Request:

{
“workerId”:“process”,
“maxTasks”:3,
“topics”:
[{“topicName”: “topic”,
“lockDuration”: 100000,
“variables”: [“name,age”]
}]
}

022-11-17 15:41:48.900 [commons-logging-3] INFO [workbench] ACCESS - {“timestamp”:“2022-11-17T15:41:48.860203”,**“request”:{“method”:“POST”,“uri”:“https://design-studio/process/workbench/engine-rest/external-task/fetchAndLock"**,“headers”:{“content-length”:[“233”],“postman-token”:[“0e9ef378313d”],“host”:[“design-studio”],“content-type”:[“application/json”],“connection”:[“keep-alive”],“accept-encoding”:["gzip , deflate, br”],“user-agent”:[“PostmanRuntime/7.26.8”],“accept”:[“/”]}},"response":{“status”:200,“headers”:{}},“timeTaken”:38}

External Task Client Request:

2022-11-17 15:36:19.146 [commons-logging-9] INFO [workbench] ACCESS - {“timestamp”:“2022-11-17T15:36:19.143195”,“request”:{“method”:“POST”,“uri”:“https://design-studio/process/workbench/engine-rest/external-task/fetchAndLock"**,“headers”:{“content-length”:[“554”],“host”:[“design-studio”],“x-authtoken”:[“xxxxxx”],“content-type”:[“application/json”,“application/json”],“connection”:[“Keep-Alive”],“accept-encoding”:[“gzip,deflate”],**“user-agent”:["Camunda External Task Client”],“accept”:[“application/json”]}},“response”:{“status”:400,“headers”:{}},“timeTaken”:0}
2022-11-17 15:36:19.147 [commons-logging-10] INFO [workbench] Response: {“timestamp”:“2022-11-17T04:36:19.145+00:00”,“status”:400,“error”:“Bad Request”,“path”:“/process/workbench/engine-rest/external-task/fetchAndLock”}

Below is the error message I’m getting
org.camunda.bpm.client [TopicSubscriptionManager] ERROR [process-worker,] - TASK/CLIENT-03001 Exception while fetch and lock task.
org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02001 Request ‘POST https://design-studio/process/workbench/engine-rest/external-task/fetchAndLock HTTP/1.1’ returned error: status code ‘400’ - message: status code: 400, reason phrase: {“timestamp”:“2022-11-17T12:09:08.003+00:00”,“status”:400,“error”:“Bad Request”,“message”:“”,“path”:“/process/workbench/engine-rest/external-task/fetchAndLock”}
at org.camunda.bpm.client.impl.EngineClientLogger.exceptionWhileReceivingResponse(EngineClientLogger.java:30)
at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:97)
at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:83)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.fetchAndLock(TopicSubscriptionManager.java:135)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:101)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:87)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.http.client.HttpResponseException: status code: 400, reason phrase: {“timestamp”:“2022-11-17T12:09:08.003+00:00”,“status”:400,“error”:“Bad Request”,“message”:“”,“path”:“/process/workbench/engine-rest/external-task/fetchAndLock”}
at org.camunda.bpm.client.impl.RequestExecutor$1.handleResponse(RequestExecutor.java:146)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:88)
… 6 common frames omitted

External Task Client Code :

@Configuration
public class HandlerConf {

	@ExternalTaskSubscription("topic")
    @Bean
    public ExternalTaskHandler sendTask() throws Exception {
        return (externalTask, externalTaskService) -> {
		//business logic 
		externalTaskService.complete(externalTask);
		}
	}
}

`application.properties:

camunda.bpm.client.base-url=https://design-studio/process/workbench/engine-rest
camunda.bpm.client.async-response-timeout=1800000
camunda.bpm.client.subscriptions.tasktopic.variable-names=[“name,age”]
camunda.bpm.client.subscriptions.topic.process-definition-key=design
camunda.bpm.client.subscriptions.topic.lock-duration=1000000
camunda.bpm.client.worker-id=worker
camunda.bpm.client.max-tasks=3
`

I tried multiple ways but it’s not working, please help me on this.

@Niall @hassang Does I missing anything, could you please help me on this.

Below is the response I’m getting if I use postman.

But if I execute the above code via Camunda External Task Client getting 400 as Bad Request.