You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When loading workflow definition with SWITCH type tasks with JS expressions, I get validation error.
Also, when loading workflow definition in task there are no inputParameters, which can lead to erroneous execution of eval() Object returnValue = ScriptEvaluator.eval(expression, inputParameters);
To Reproduce
Сreate a workflow definition with a SWITCH type task with an expression:
function check(){
var inputResult = $.inputResult;
var result = "OK";
if (!inputResult || !inputResult.serviceResult || inputResult.serviceResult.resultType === "ERROR") {
result = "ERROR";
}
if (inputResult.serviceResult.resultCode === "-1001") {
result = "NOT_FOUND";
}
return result;
}
check()
Get the logs:
ConstraintViolationImpl{interpolatedMessage='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK', propertyPath=tasks[12], rootBeanClass=class com.netflix.conductor.common.metadata.workflow.WorkflowDef, messageTemplate='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK'}
Expected behavior
Before the upgrade, these tasks with expressions worked properly and eval() returned the expected result
Everything was solved by passing to the input only those fields that were required in this expression. But filtering still had to be moved to jsonPath, because validation did not pass on the expression "expression": "Java.from($.statuses).filter(function (el) { return el.toLowerCase() !== 'ok' }).length > 0"
Describe the bug
When loading workflow definition with SWITCH type tasks with JS expressions, I get validation error.
Also, when loading workflow definition in task there are no inputParameters, which can lead to erroneous execution of eval()
Object returnValue = ScriptEvaluator.eval(expression, inputParameters);
Details
Conductor version: 3.16.0
Persistence implementation: Redis
Queue implementation: Dynoqueues
Lock: Redis
Task definition: SWITCH
To Reproduce
Сreate a workflow definition with a SWITCH type task with an expression:
Get the logs:
ConstraintViolationImpl{interpolatedMessage='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK', propertyPath=tasks[12], rootBeanClass=class com.netflix.conductor.common.metadata.workflow.WorkflowDef, messageTemplate='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK'}
Expected behavior
Before the upgrade, these tasks with expressions worked properly and eval() returned the expected result
Additional context
changes in validation with version upgrade:
Netflix/conductor#3805
The text was updated successfully, but these errors were encountered: