Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Failed to build variable mapping expression #8066

Closed
remcowesterhoud opened this issue Oct 26, 2021 · 7 comments · Fixed by #8513
Closed

IllegalStateException: Failed to build variable mapping expression #8066

remcowesterhoud opened this issue Oct 26, 2021 · 7 comments · Fixed by #8513
Labels
kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/low Marks a bug as having little to no noticeable impact for the user version:1.3.1 Marks an issue as being completely or in parts released in 1.3.1

Comments

@remcowesterhoud
Copy link
Contributor

remcowesterhoud commented Oct 26, 2021

Describe the bug
Customer tries to deploy a process with a specific output variable mapping. Instead of breaking on validation, the deployment fails with an exception. This occurred in a production cluster.

https://console.cloud.google.com/errors/CPu8oYycy-7NWQ?service=zeebe&time=P7D&refresh=off&project=camunda-cloud-240911

To Reproduce

Deploy this process using Zeebe 1.2

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1l8zqol" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.1.0">
  <bpmn:process id="Process_00dmwud" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>Flow_0b71pnj</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:endEvent id="Event_12llkjs">
      <bpmn:incoming>Flow_0hl1ts4</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0b71pnj" sourceRef="StartEvent_1" targetRef="Activity_13r0dql" />
    <bpmn:sequenceFlow id="Flow_0hl1ts4" sourceRef="Activity_13r0dql" targetRef="Event_12llkjs" />
    <bpmn:serviceTask id="Activity_13r0dql">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="type" retries="1" />
        <zeebe:ioMapping>
          <zeebe:output source="= result.CheckProcess.generalClassifications.operational[type=&#34;ACCOUNTING_PERIOD_VALIDATION&#34;][1]" target="accountingPeriodValidation.operational" />
          <zeebe:output source="= result.CheckProcess.generalClassifications.heating[type=&#34;ACCOUNTING_PERIOD_VALIDATION&#34;][1]" target="accountingPeriodValidation.heating" />
          <zeebe:output source="= result.CheckProcess.tenancy.utilityBill.operational" target="formalRequirementValidation.operational" />
          <zeebe:output source="= result.CheckProcess.tenancy.utilityBill.heating" target="formalRequirementValidation.heating" />
        </zeebe:ioMapping>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_0b71pnj</bpmn:incoming>
      <bpmn:outgoing>Flow_0hl1ts4</bpmn:outgoing>
    </bpmn:serviceTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_00dmwud">
      <bpmndi:BPMNEdge id="Flow_0hl1ts4_di" bpmnElement="Flow_0hl1ts4">
        <di:waypoint x="360" y="117" />
        <di:waypoint x="412" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0b71pnj_di" bpmnElement="Flow_0b71pnj">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="260" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="179" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_12llkjs_di" bpmnElement="Event_12llkjs">
        <dc:Bounds x="412" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0s27z46_di" bpmnElement="Activity_13r0dql">
        <dc:Bounds x="260" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Expected behavior
A deployment validation would fail if the expression is invalid. Otherwise, the process should be deployed.

Log/Stacktrace

Full Stacktrace

java.lang.IllegalStateException: Failed to build variable mapping expression: failed to parse expression '{accountingPeriodValidation:if (accountingPeriodValidation = null) then {operational: result.CheckProcess.generalClassifications.operational[type="ACCOUNTING_PERIOD_VALIDATION"][1],heating: result.CheckProcess.generalClassifications.heating[type="ACCOUNTING_PERIOD_VALIDATION"][1]} else put all(accountingPeriodValidation,{operational: result.CheckProcess.generalClassifications.operational[type="ACCOUNTING_PERIOD_VALIDATION"][1],heating: result.CheckProcess.generalClassifications.heating[type="ACCOUNTING_PERIOD_VALIDATION"][1]}),formalRequirementValidation:if (formalRequirementValidation = null) then {operational: result.CheckProcess.tenancy.utilityBill.operational,heating: result.CheckProcess.tenancy.utilityBill.heating} else put all(formalRequirementValidation,{operational: result.CheckProcess.tenancy.utilityBill.operational,heating: result.CheckProcess.tenancy.utilityBill.heating})}': Expected (expressionWithContinuation | functionDefinition | forExpression | ifExpression | quantifiedExpression | expression2):1:1, found "{accountin"
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.VariableMappingTransformer.parseExpression(VariableMappingTransformer.java:187) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.VariableMappingTransformer.transformOutputMappings(VariableMappingTransformer.java:93) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.FlowNodeTransformer.lambda$transformIoMappings$3(FlowNodeTransformer.java:72) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at java.util.Optional.map(Unknown Source) ~[?:?]
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.FlowNodeTransformer.transformIoMappings(FlowNodeTransformer.java:70) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.FlowNodeTransformer.transform(FlowNodeTransformer.java:38) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformer.FlowNodeTransformer.transform(FlowNodeTransformer.java:21) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformationVisitor.visit(TransformationVisitor.java:42) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.model.bpmn.traversal.TypeHierarchyVisitor.visit(TypeHierarchyVisitor.java:39) ~[zeebe-bpmn-model-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.model.bpmn.traversal.ModelWalker.walk(ModelWalker.java:61) ~[zeebe-bpmn-model-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.model.transformation.BpmnTransformer.transformDefinitions(BpmnTransformer.java:111) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.transform.DeploymentTransformer.transformResource(DeploymentTransformer.java:123) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.transform.DeploymentTransformer.transform(DeploymentTransformer.java:96) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.deployment.DeploymentCreateProcessor.processRecord(DeploymentCreateProcessor.java:100) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.TypedRecordProcessor.processRecord(TypedRecordProcessor.java:54) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.lambda$processInTransaction$2(ProcessingStateMachine.java:258) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.db.impl.rocksdb.transaction.ZeebeTransaction.run(ZeebeTransaction.java:84) ~[zeebe-db-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processInTransaction(ProcessingStateMachine.java:248) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.processEvent(ProcessingStateMachine.java:216) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.tryToReadNextEvent(ProcessingStateMachine.java:191) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.engine.processing.streamprocessor.ProcessingStateMachine.readNextEvent(ProcessingStateMachine.java:183) ~[zeebe-workflow-engine-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorJob.invoke(ActorJob.java:73) [zeebe-util-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorJob.execute(ActorJob.java:39) [zeebe-util-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorTask.execute(ActorTask.java:122) [zeebe-util-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorThread.executeCurrentTask(ActorThread.java:95) [zeebe-util-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorThread.doWork(ActorThread.java:78) [zeebe-util-1.2.1.jar:1.2.1]
	at io.camunda.zeebe.util.sched.ActorThread.run(ActorThread.java:192) [zeebe-util-1.2.1.jar:1.2.1]

Environment:

  • OS: Camunda Cloud
  • Zeebe Version: 1.2.1
@remcowesterhoud remcowesterhoud added kind/bug Categorizes an issue or PR as a bug Impact: Usability scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/low Marks a bug as having little to no noticeable impact for the user labels Oct 26, 2021
@remcowesterhoud
Copy link
Contributor Author

Expression = x.y[z = 0][1] causes this issue. = x[z = 0][1] works without a problem. = x.y[z = 0] also works without issue.
It seems to only go wrong when chaining square brackets (filter expressions?) on an inner value.

@Zelldon
Copy link
Member

Zelldon commented Oct 27, 2021

Would be interesting whether the complete bracket notation works ?
Like:

=['x']['y']['z = 0'][1]

https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html

@remcowesterhoud
Copy link
Contributor Author

I've tried it using = x['y']['z = 0'][1], which does not cause the error, but fails on a validation. But just x['y'] also fails on the same validation, so I have a feeling this bracket notation is not supported at all.

@Zelldon
Copy link
Member

Zelldon commented Oct 27, 2021

afaik this is not valid: x['y'] it should be ['x']['y'] then.

@remcowesterhoud
Copy link
Contributor Author

We need to start at a root object somewhere. In x['y]' I would say x is the root object and we try to access y in x.
With ['x']['y'] we are trying to access the field y in x in what root object?

In the link you send they also start with $ with refers to the root object or array.

Either way, I've tested it both and they both fail on the same validation.

@Zelldon
Copy link
Member

Zelldon commented Oct 27, 2021

Ok thanks for checking :D

@npepinpe
Copy link
Member

Please open an issue in the FEEL scala project, and link it here. For Zeebe, for now, I will leave it in the backlog as it had very low impact.

@ghost ghost closed this as completed in #8513 Jan 4, 2022
@ghost ghost closed this as completed in 2eb67be Jan 4, 2022
ghost pushed a commit that referenced this issue Jan 6, 2022
8529: [Backport stable/1.3] deps(maven): bump feel-engine from 1.13.3 to 1.14.1 r=saig0 a=github-actions[bot]

# Description
Backport of #8513 to `stable/1.3`.

relates to #8066 #7758

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@npepinpe npepinpe added the version:1.3.1 Marks an issue as being completely or in parts released in 1.3.1 label Jan 17, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/low Marks a bug as having little to no noticeable impact for the user version:1.3.1 Marks an issue as being completely or in parts released in 1.3.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants