Hi,
I get this error from my test which is using bpmn spec. I this the errors gives all the details needed, but I dont understand why is it failing
variables=[ProcessInstanceVariable(variableName=config, variableValue="{\"flappingDetectionWorkflowConfig\":{\"isEnabled\":false,\"bufferTime\":60.000000000,\"type\":\"FLAPPING_DETECTION\",\"bufferTimeInISOFormat\":\"PT1M\"},\"perpetualDetectionWorkflowConfig\":{\"isEnabled\":true},\"alarmId\":\"NOT-IN-USE\",\"workflowId\":\"NOT-IN-USE\"}", scopeElementId=PreProcessingProcess, scopeElementName=), ProcessInstanceVariable(variableName=perpetualOutcome, variableValue="WAIT", scopeElementId=PreProcessingProcess, scopeElementName=)], incidents=[Incident(errorType=EXTRACT_VALUE_ERROR, errorMessage=failed to evaluate expression ' config.flappingDetectionWorkflowConfig.isEnabled = false': expected Context or List of Contextes but found 'ValString({"flappingDetectionWorkflowConfig":{"isEnabled":false,"bufferTime":60.000000000,"type":"FLAPPING_DETECTION","bufferTimeInISOFormat":"PT1M"},"perpetualDetectionWorkflowConfig":{"isEnabled":true},"alarmId":"NOT-IN-USE","workflowId":"NOT-IN-USE"})', elementId=Gateway_177t2q7, elementName=Is FD Enable, state=CREATED)])]]
Expecting value to be true but was false
Expected :true
Actual :false
The actual error is failed to evaluate expression ' config.flappingDetectionWorkflowConfig.isEnabled = false
, but I see that the value is passed correctly.
Any help please. Let me know as well if this is not clear enough
Hi @sherry-ummen,
it seems that the variable config
is stored as a string instead of a JSON document.
Please check the client code that passes the variable in the process (e.g. the create instance command).
Does this help you?
Best regards,
Philipp
thanks Philipp, so I have it done this way
createInstance(
bpmnProcessId = workflowProcessId,
mapOf("config" to mapper.toJson(getDummyData()))
)
So it is JsonString … so it seems this is not correct way to do it. I cannot pass the actual object else I will hit the issuse spring boot - Java 8 date/time type java.time.Instant
not supported by default Issue : - Stack Overflow . so to overcome that I just parse it to json string with the custom mapper
Then I tried to create my dummy object like this to remove the dateTime object from it
private fun getDummyPreprocessWorkflowConfig(isFlappingEnabled: Boolean = false): DummyPreprocessConfigData {
return DummyPreprocessConfigData(
flappingDetectionWorkflowConfig = DummyFlappingConfigData(
isEnabled = isFlappingEnabled
)
)
}
data class DummyPreprocessConfigData(
val flappingDetectionWorkflowConfig: DummyFlappingConfigData
)
data class DummyFlappingConfigData(val isEnabled: Boolean)
But weird thing is that the variable name isEnabled
becomes enabled
like this
variables=[ProcessInstanceVariable(variableName=config, variableValue={"flappingDetectionWorkflowConfig":{"enabled":false}},
why did it change the variable name ? I found this issue java - Jackson renames primitive boolean field by removing ‘is’ - Stack Overflow
but this does not happen when running the code via the client lib, but happens only with the tests
@sherry-ummen thank you for providing the information.
Regarding the serialization of Instant
:
If you want to use the temporal value in the process (i.e. in an expression) then you should serialize the temporal value as a string.
Zeebe uses JSON (i.e. MessagePack) to serialize process variables. But JSON doesn’t support temporal values natively.
Regarding:
but this does not happen when running the code via the client lib, but happens only with the tests
How do you create the process instance?
Do you use a Zeebe client? Or, do you use the builder API from BPMN-Spec?
1 Like