Closed venetrius closed 1 month ago
Let's try to fix it in the NodeJS XTaC as well or create a follow-up issue.
I still have to create a new task for External JavaScript Client or apply a fix in this ticket.
@gbetances089 QA hand over note. Scenarios to test:
Please see linked Jira issue for example BPMN.
Tested on 7.22.0-alpha6
release candidate.
Environment (Required on creation)
Reported and reproduced on 7.21-ee
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)
When trying to access the value of a local file Variable
vars.getValueTyped("localFile") .getValue();
, we get the following error message:Steps to reproduce (Required on creation)
def sampleContent = "someRandomFileContent"; def file = Variables.fileValue("sample.txt").file(sampleContent.getBytes()).mimeType("text/plain").create();
execution.setVariable('fileInProcess', file);
${execution.getVariableTyped("fileInProcess")}
Expected behavior (Required on creation)
The call to VariableMap::getValueTyped should return the actual value of the fileValue and don’t throw an error.
Root Cause (Required on prioritization)
In the class
org.camunda.bpm.client.impl.EngineClient
, the methodgetLocalBinaryVariable
gets called from DeferredFileValueImpl::load with theprocessInstanceId
instead of theexecutionId
. The request sent to the rest-api looks like:{{GET /execution/{processInstanceId}/localVariables/{name}/data}}
It tries to resolve a variable from the top level process instance execution instead of using the actual child execution where the local variable is set.When executing the request (with the processInstanceId) in postman, i get the same error. When using the actual executionId of the externalTask
{{GET /execution/{excecutionId}/localVariables/{name}/data}}
, i get the correct variable value/file content.Solution Ideas
Current attempt to retrieve content of a Variable:
Using https://docs.camunda.org/rest/camunda-bpm-platform/7.21/#tag/Process-Instance/operation/getProcessInstanceVariableBinary with the executionId would work for both local and global variables:
The
executionId
can be set on theDeferredFileValueImpl
instance when theinstanceVariable
is returned from ExternalTaskImpl.javagetVariable
,getAllVariablesTyped
,getVariableTyped
functions.Hints
Links
Dev2QA handover