Deserialisation Error in script defined variable

Good day,

  • So I create an output variable using a script with a default
  • The variable is a list, empty, but I have tried both empty and a single element

  • I have tries both defining it as an empty “List” in the modeler and through this script.
  • When I try to consume, the variable I get a deserialisation error

  • I use this method elsewhere to good effect, the only difference is here I definitions are solely in scripts.
  • I also notice the type of the variable is:

“com.oracle.truffle.polyglot.PolyglotMap<java.lang.Object,java.lang.Object>”

This is the log error for it:

10-Feb-2022 12:00:56.022 WARNING [http-nio-8080-exec-175] org.camunda.commons.logging.BaseLogger.logWarn ENGINE-REST-HTTP500 org.camunda.bpm.engine.ProcessEngineException: Cannot deserialize object in variable 'tweetsToReplyTo': begin 0, end 10, length 2
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:85)
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:31)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:105)
	at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.getTypedValue(VariableInstanceEntity.java:278)
	at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getValueFromVariableInstance(AbstractVariableScope.java:142)
	at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getVariable(AbstractVariableScope.java:129)
	at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getVariable(AbstractVariableScope.java:125)
	at org.camunda.bpm.engine.impl.scripting.engine.VariableScopeResolver.get(VariableScopeResolver.java:52)
	at org.camunda.bpm.engine.impl.scripting.engine.ScriptBindings.calculateBindingMap(ScriptBindings.java:186)
	at org.camunda.bpm.engine.impl.scripting.engine.ScriptBindings.entrySet(ScriptBindings.java:140)
	at java.base/java.util.AbstractMap.putAll(AbstractMap.java:280)
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.getOrCreateGraalJSBindings(GraalJSScriptEngine.java:464)
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:420)
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:396)
	at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
	at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluateScript(SourceExecutableScript.java:125)
	at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluate(SourceExecutableScript.java:65)
	at org.camunda.bpm.engine.impl.scripting.ExecutableScript.execute(ExecutableScript.java:63)
	at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:95)
	at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:87)
	at org.camunda.bpm.engine.impl.delegate.ScriptInvocation.invoke(ScriptInvocation.java:47)
	at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:58)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:92)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:63)
	at org.camunda.bpm.engine.impl.scripting.ScriptValueProvider.getValue(ScriptValueProvider.java:46)
	at org.camunda.bpm.engine.impl.core.variable.mapping.OutputParameter.execute(OutputParameter.java:47)
	at org.camunda.bpm.engine.impl.core.variable.mapping.IoParameter.execute(IoParameter.java:51)
	at org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping.executeOutputParameters(IoMapping.java:45)

...

Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 10, length 2
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3734)
	at java.base/java.lang.String.substring(String.java:1903)
	at org.camunda.spin.impl.json.jackson.JacksonJsonLogger.unableToDeserialize(JacksonJsonLogger.java:71)
	at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:100)
	at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:84)
	at org.camunda.spin.plugin.impl.SpinObjectValueSerializer.deserializeFromByteArray(SpinObjectValueSerializer.java:101)
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractObjectValueSerializer.deserializeFromByteArray(AbstractObjectValueSerializer.java:119)
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:83)
	... 291 more

Hello! you need to upgrade version( org.graalvm.js-> js-scriptengine-22.3.3, org.graalvm.js → js-22.3.3, org.graalvm.sdk->graal-sdk-22.3.3) and the error should go away.
I simply replaced them with new packages when assembling them in the Camunda container.