Hi, I’m having some problems when trying to assign a zeebe user task using zeebeClient.
I run Camunda 8.7 self-managed using docker-compose locally, in multi-tenancy mode.
I use the spring-boot SDK 8.7.
I create an instance of my workflow and then look up the user task using CamundaTaskListClient and then try to assign it to the demo user with the command
zeebeClient.newUserTaskAssignCommand
But I obtain the error NOT FOUND
I report some piece of logs:
POST /v2/user-tasks/2251799813685298/assignment HTTP/1.1
Authorization: Bearer .....
Accept: application/json, application/problem+json
User-Agent: zeebe-client-java/8.7.1
Content-Length: 19
Content-Type: application/json; charset=UTF-8
Host: 127.0.0.1:8080
Received [POST /v2/user-tasks/2251799813685299/assignment HTTP/1.1
Authorization: Bearer ......
Accept: application/json, application/problem+json
User-Agent: zeebe-client-java/8.7.0
Content-Length: 19
Content-Type: application/json; charset=UTF-8
Host: 127.0.0.1:8080
Connection: keep-alive
{"assignee":"demo"}]
No mapping for POST /v2/user-tasks/2251799813685299/assignment
No endpoint POST /v2/user-tasks/2251799813685299/assignment.
Resolved [org.springframework.web.servlet.NoHandlerFoundException: No endpoint POST /v2/user-tasks/2251799813685299/assignment.]
Completed 404 NOT_FOUND
Set SecurityContextHolder to anonymous SecurityContext
[API Response] Action: POST, Url: /v2/user-tasks/2251799813685299/assignment, Query String: -- NA --, Http Status: 404,
If I try to assign and complete the user task from TaskList UI, all operations end successfully.
Thanks a lot for any suggestions,
Elisa
Hi @crocie - I suspect that you need to enable the alpha endpoints. Not all of the new REST endpoints are out of alpha yet, but the alpha is quite stable and I recommend developing against it rather than waiting.
1 Like
Hi @nathan.loding , sorry but I don’t understand where should I put CAMUNDA_REST_QUERY_ENABLED
.
I’m using docker-compose of Camunda 8.7.
I tried to add this env variable inside zeebe service in my docker-compose.yml
services:
zeebe:
…
enviroment:
…
- CAMUNDA_REST_QUERY_ENABLED=true"
but nothing changed when I run with this new configuration.
I also tried inside the application.properties of my spring-boot application but the property isn’t recognized (Cannot resolve configuration property ‘camunda.rest.query.enabled’ )
camunda.rest.query.enabled=true
In my pom.xml I have the dep:
<dependency>
<groupId>io.camunda</groupId>
<artifactId>spring-boot-starter-camunda-sdk</artifactId>
<version>8.7.0</version>
</dependency>
Thanks,
Elisa
@crocie - that should all you need, I think. Can you share the full docker-compose.yaml file? (You don’t need to enable anything in your Spring application, just in the Camunda deployment)
Hello @nathan.loding 
I upload my docker-compose.yml.
docker-compose.yaml (23.0 KB)
My .env file contains these settings:
## Image versions ##
# renovate: datasource=docker depName=camunda/connectors-bundle
CAMUNDA_CONNECTORS_VERSION=8.7.0
# renovate: datasource=docker depName=camunda/zeebe
CAMUNDA_ZEEBE_VERSION=8.7.1
# renovate: datasource=docker depName=camunda/identity
CAMUNDA_IDENTITY_VERSION=8.7.0
# renovate: datasource=docker depName=camunda/operate
CAMUNDA_OPERATE_VERSION=8.7.1
# renovate: datasource=docker depName=camunda/tasklist
CAMUNDA_TASKLIST_VERSION=8.7.1
# renovate: datasource=docker depName=camunda/optimize
CAMUNDA_OPTIMIZE_VERSION=8.7.0
# renovate: datasource=docker depName=camunda/web-modeler-restapi
CAMUNDA_WEB_MODELER_VERSION=8.7.0
# renovate: datasource=docker depName=elasticsearch
ELASTIC_VERSION=8.17.5
KEYCLOAK_SERVER_VERSION=24.0.5
# renovate: datasource=docker depName=axllent/mailpit
MAILPIT_VERSION=v1.21.8
POSTGRES_VERSION=14.5-alpine
HOST=localhost
KEYCLOAK_HOST=localhost
## Configuration ##
# By default the zeebe api is public, when setting this to `identity` a valid zeebe client token is required
ZEEBE_AUTHENTICATION_MODE=identity
ZEEBE_CLIENT_ID=zeebe
ZEEBE_CLIENT_SECRET=zecret
# Set to 'true' to enable resource based authorizations for users and groups
# This can be used to limit access for users or groups to view/update specific
# processes and decisions in Operate and Tasklist
RESOURCE_AUTHORIZATIONS_ENABLED=false
# Set to 'true' to enable multi-tenancy across all components
# This requires use of identity for authentication
#
# ZEEBE_AUTHENTICATION_MODE=identity
#
MULTI_TENANCY_ENABLED=true
Hi @crocie - I downloaded that file, saved your .env values to my .env file, and started it up (I did comment out all the Web Modeler services to keep testing simpler, it shouldn’t have an effect). It did work work for me.
When you added the CAMUNDA_REST_QUERY_ENABLED
env var, how did apply that configuration to your running containers? If you open Docker and inspect the environment variables of the zeebe container, do you see that variable? (I used the UI, but I think the command is docker exec zeebe env
)
Hi @nathan.loding, I ran the docker command and I see the env variable of search active:
But from my Spring application, the assignment keeps failing.
Maybe I have some wrong value in the application.yml? I paste here the properties of workflow:
camunda.api.identity.rest-address=http://127.0.0.1:8084
camunda.client.mode=self-managed
camunda.client.auth.client-id=aaaaa
camunda.client.auth.client-secret=aaaaa
camunda.client.auth.authorizationServerUrl=http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
camunda.client.zeebe.enabled=true
camunda.client.zeebe.grpc-address=http://127.0.0.1:26500
camunda.client.zeebe.rest-address=http://127.0.0.1:8080
# When completing jobs programmatically, you must specify autoComplete = false. Otherwise,
# there is a race condition between your programmatic job completion and the Spring integration job completion,
# and this can lead to unpredictable results.
camunda.client.zeebe.defaults.auto-complete=false
#When start application first time you should onboard a tenant with this name
camunda.client.zeebe.defaults.tenant-ids=showcase
tasklist.client.profile=oidc
tasklist.client.enabled=true
tasklist.client.base-url=http://localhost:8082
tasklist.client.auth-url=http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
tasklist.client.audience=tasklist-api
tasklist.client.client-id=aaaaa
tasklist.client.client-secret=aaaaa
tasklist.client.defaults.load-truncated-variables=true
tasklist.client.defaults.return-variables=true
tasklist.client.defaults.use-zeebe-user-tasks=true
operate.client.profile=oidc
operate.client.enabled=true
operate.client.base-url=http://localhost:8082
operate.client.auth-url=http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
operate.client.audience=operate-api
operate.client.client-id=aaaaa
operate.client.client-secret=aaaaa
logging.level.root=debug
logging.level.org.camunda=trace
logging.level.io.camunda=trace
And the client configuration on tenant showcase in Identity is:
@crocie - that is strange. What if you test the API outside of your Spring application with something like curl or Postman? Here are curl examples, be sure to replace the variables/placeholders with your values.
Get a token:
curl --request POST http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
camunda.client.zeebe.enabled=true \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode "audience=tasklist-api" \
--data-urlencode "client_id=${ZEEBE_CLIENT_ID}" \
--data-urlencode "client_secret=${ZEEBE_CLIENT_SECRET}"
Assign a user:
curl -L 'http://localhost:8080/v2/user-tasks/:userTaskKey/assignment' \
-H 'Content-Type: application/json' \
-H 'Bearer: ${TOKEN}}}' \
-d '{
"assignee": "abc@def.com
}'
Thanks @nathan.loding for your support!
Using postman I obtain the token from keycloak, but I still have issue to assign user task.
Maybe is a problem on network mapping?
In fact using the browser on Windows I can reach the swagger at address http://localhost:8082 where I see that the requests will be redirected to http://localhost:8080/v2/.
Using Post when I call
POST http://localhost:8080/v2/user-tasks/2251799813685257/assignment
I have the error:
Error: connect ECONNREFUSED 127.0.0.1:8080
I tried also call the same endpoint but on 8082 (any sense?) and I obtain this error:
{
"type": "about:blank",
"title": "io.camunda.zeebe.broker.client.api.PartitionNotFoundException",
"status": 503,
"detail": "Expected to handle REST API request, but request could not be delivered",
"instance": "/v2/user-tasks/2251799813685257/assignment"
}
If I run the command to look for busy doors, no process run on 8080.
I see that all others ports are busy (8082, 18080, 8084…).
@crocie - oops, I made a typo, I think the correct URL should be on port 8088 (if you look at line #20 of the docker-compose file).
1 Like
Super @nathan.loding , using Postman I assigned a user task correctly.
So, maybe I have to change in my application.yml this line?
camunda.client.zeebe.rest-address=http://127.0.0.1:8080
to
camunda.client.zeebe.rest-address=http://127.0.0.1:8088
Where does your zeebeClient run?
If it’s in it’s own Docker Container, then http://127.0.0.1:8088 nor http://127.0.0.1:8080 would work, as that would direct the zeebeClient to connect to the same container that it’s in. It should be something like http://zeebe:8080
If the zeebeClient is running local to the PC that is also running Docker (eg. same place that you’re running Postman), then yes, updating to http://127.0.0.1:8088 should work.
1 Like