Open hassan-alnator opened 3 weeks ago
Hi @hassan-alnator, could you please make a minimal reproducer that I can check out and run locally? That way we know we are talking about the exact same thing as we step through it.
I uploaded the exact example and all its files here: https://github.com/hassan-alnator/camunda-8-sdk-example
just run the "main.ts" file
Ah, when you say "just run the main.ts file", what command is it?
ts-node main.ts
and tsc && node main.js
both fail on my machine.
Update:
tsc --init && tsc && node main.js
did it.
I'm using these credentials:
# Self-Managed
export ZEEBE_ADDRESS='localhost:26500'
export ZEEBE_REST_ADDRESS='http://localhost:8080'
export ZEEBE_GRPC_ADDRESS='localhost:26500'
export ZEEBE_CLIENT_ID='zeebe'
export ZEEBE_CLIENT_SECRET='zecret'
export CAMUNDA_OAUTH_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token'
export ZEEBE_AUTHORIZATION_SERVER_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token'
export CAMUNDA_TASKLIST_BASE_URL='http://localhost:8082'
export CAMUNDA_OPERATE_BASE_URL='http://localhost:8081'
export CAMUNDA_OPTIMIZE_BASE_URL='http://localhost:8083'
export CAMUNDA_MODELER_BASE_URL='http://localhost:8070/api'
export CAMUNDA_ZEEBE_OAUTH_AUDIENCE='zeebe.camunda.io'
# Needed for Multi-Tenancy
export CAMUNDA_TENANT_ID='<default>'
# TLS for gRPC is on by default. If the Zeebe broker is not secured by TLS, turn it off
export CAMUNDA_SECURE_CONNECTION=false
export ZEEBE_INSECURE_CONNECTION=true
export CAMUNDA_OAUTH_TOKEN_REFRESH_THRESHOLD_MS=10000
export CAMUNDA_AUTH_STRATEGY=OAUTH
export CAMUNDA_OPTIMIZE_OAUTH_AUDIENCE="optimize-api"
I get an error because the bpmn is not found, since no model is deployed in the example code.
Error: 5 NOT_FOUND: Command 'CREATE_WITH_AWAITING_RESULT' rejected with code 'NOT_FOUND': Expected to find process definition with process ID 'c8-sdk-demo', but none found
at callErrorFromStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/client.js:193:76)
at /Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/call-interface.js:78:35
at Object.onReceiveStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@camunda8/sdk/dist/zeebe/lib/GrpcClient.js:102:36)
at InterceptingListenerImpl.onReceiveStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/call-interface.js:73:23)
at Object.onReceiveStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
at Object.onReceiveStatus (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
at /Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
for call at
at ServiceClientImpl.makeUnaryRequest (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/client.js:161:32)
at ServiceClientImpl.<anonymous> (/Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
at /Users/jwulf/workspace/camunda-8-sdk-example/node_modules/@camunda8/sdk/dist/zeebe/lib/GrpcClient.js:306:47
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: 5,
details: "Command 'CREATE_WITH_AWAITING_RESULT' rejected with code 'NOT_FOUND': Expected to find process definition with process ID 'c8-sdk-demo', but none found",
metadata: Metadata {
internalRepr: Map(2) {
'content-type' => [ 'application/grpc' ],
'grpc-status-details-bin' => [
Buffer(156) [Uint8Array] [
8, 5, 18, 151, 1, 67, 111, 109, 109, 97, 110, 100,
32, 39, 67, 82, 69, 65, 84, 69, 95, 87, 73, 84,
72, 95, 65, 87, 65, 73, 84, 73, 78, 71, 95, 82,
69, 83, 85, 76, 84, 39, 32, 114, 101, 106, 101, 99,
116, 101, 100, 32, 119, 105, 116, 104, 32, 99, 111, 100,
101, 32, 39, 78, 79, 84, 95, 70, 79, 85, 78, 68,
39, 58, 32, 69, 120, 112, 101, 99, 116, 101, 100, 32,
116, 111, 32, 102, 105, 110, 100, 32, 112, 114, 111, 99,
101, 115, 115, 32,
... 56 more items
]
]
},
options: {}
}
}
based on this error I think because am using bun it already wraps everything with an async function just wrap the zeebe.createProcessInstanceWithResult with an async function .
( async () => {
const p = await zeebe.createProcessInstanceWithResult({
bpmnProcessId: `c8-sdk-demo`,
variables: {
humanTaskStatus: 'Needs doing',
},
});
})();
The error is because there is no model deployed. The reproducer needs a .bpmn file and a call to deployResources
to deploy it.
BPMN File attached, but the error happens before starting any process
I sent a PR against the MR. I can't get it to throw the error that you are seeing. Let's get the patched MR running on your machine, so that we are looking at the same code and state, and then see how to break it the way you are seeing.
An error is happening when the sdk is trying to request a token with self hosted environments
Environment Variables
Client ID & Client Secret
Environment
Sample Code
SDK Component
Zeebe, operate and tasklist
Expected Behavior
The SDK should authenticate and proceed to create a process instance
Current Behavior
Erroring requesting token for Client Id zeebe
Steps to Reproduce
Context (Environment)
Self hosting using the default docker compose