Example "camunda-react-app" doesn't work

Hi All,

I am just trying to learn how to use react.js to interact with a camunda workflow

I found in https://github.com/camunda-consulting/code a proof of the concept called “camunda-react-app” that should implement an external cockpit for camunda.

I installed and configured properly to work with my implementation, so using the app I deployed the example workflow included in the code.

Using the app I tried to start workflow, a form appears and when i submit i find into console of browser the failing of

http://localhost:3000/engine-rest/process-definition/key/myprocess/start

with the following response

{“type”:“RestException”,“message”:“Cannot instantiate process definition myprocess:1:e531bcd7-9f30-11ea-863c-0a580a810368: Cannot serialize object in variable ‘test’: SPIN/DOM-XML-01030 Cannot create context”}

Someone used the same app?

myprocess.bpmn (7.9 KB)

If I try to start the same workflow by camunda tasklist i have the following window

My suspect it that tha workflow is not correct.

Regards
Olindo

Please check http://localhost:3000/startProcess/list the myprocess.bpm is deployed.

I hit the postman to send the Post for the http://localhost:3000/engine-rest/process-definition/key/myprocess/start

Header : Content-type : application/json
Body (raw) : Pass the json

{
“variables”: {
“fistName”: {
“value”:“pindaroli”
},
“lastName”: {
“value”: “test”
},
“email”: {
“value” : “abc@yahoo.in”
},
“items”:{
“value”: “item-xyz”
}
}
}

Hope it helps. It was working for me as expected

{

“type”: “RestException”,

“message”: “Cannot instantiate process definition myprocess:1:e531bcd7-9f30-11ea-863c-0a580a810368: Cannot serialize object in variable ‘test’: SPIN/DOM-XML-01030 Cannot create context”

}

does your payload contains test as a process variable? How does your payload look like?

this is payload
{“variables”:{“firstName”:{“value”:“Pindaro”},“lastName”:{“value”:“Maria”},“email”:{“value":"o.pindaro@gmail.com”},“items”:{“value”:“pippo”}}}

@pindaroli if you check the stacktrace which you posted, it’s referring the variable test

Somewhere in your code variable test is used. Please verify it.

here is a javascript variable

@pindaroli variable test is not serialized. Serialize the variable and then do setVariable operation.

try like this below code:

var test = S({"test":"hello"});
execution.setVariable("test",test);
1 Like

Your suggestion didn’t work:

{“type”:“IllegalArgumentException”,“message”:“SPIN-01001 Unsupported input of type ‘jdk.nashorn.api.scripting.ScriptObjectMirror’”}

I can bypass using (i don’t like the solution)

var test = “\”{\“test”:\“hello\”}\""
execution.setVariable(“test”,test);

@pindaroli, it should be like this, json string should be surrounded with ''.

var test = S('{"test":"hello"}');

execution.setVariable(“test”,test.toString());

S represents SPIN, so below dependency need to be in claspath:

<dependencies>
  <dependency>
    <groupId>org.camunda.spin</groupId>
    <artifactId>camunda-spin-core</artifactId>
  </dependency>

  <dependency>
    <groupId>org.camunda.spin</groupId>
    <artifactId>camunda-spin-dataformat-all</artifactId>
  </dependency>
</dependencies>

Anyway, var test = “\”{\“test”:\“hello\”}\"" also will solve the problem.

How i can find a complete description of javascrip API for camunda?

https://docs.camunda.org/manual/7.12/reference/spin/json/01-reading-json/

https://docs.camunda.org/manual/7.12/user-guide/data-formats/json/

https://docs.camunda.org/manual/7.12/user-guide/data-formats/configuring-spin-integration/

https://blog.camunda.com/post/2015/02/data-mapping-and-transformation-with/