JSON problem when completing external task


#1

I reproduced the error in postman with intercepted payload and URL :

But my JSON seems okay on JSON lint, and all returned vars exist in my process.

I’ve got this terminal output :
Caused by: javax.script.ScriptException: SyntaxError: Invalid JSON: :1:0 Expected json literal but found N
Not found
^ in at line number 2
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluateScript(SourceExecutableScript.java:114)
… 196 more
Caused by: :2 SyntaxError: Invalid JSON: :1:0 Expected json literal but found N
Not found
^
at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
at jdk.nashorn.internal.runtime.ECMAErrors.syntaxError(ECMAErrors.java:160)
at jdk.nashorn.internal.runtime.ECMAErrors.syntaxError(ECMAErrors.java:145)
at jdk.nashorn.internal.runtime.JSONFunctions.parse(JSONFunctions.java:81)
at jdk.nashorn.internal.objects.NativeJSON.parse(NativeJSON.java:119)
at jdk.nashorn.internal.scripts.Script$23$^eval_.:program(:2)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
… 201 more
Caused by: jdk.nashorn.internal.runtime.ParserException: :1:0 Expected json literal but found N
Not found
^
at jdk.nashorn.internal.parser.JSONParser.error(JSONParser.java:529)
at jdk.nashorn.internal.parser.JSONParser.error(JSONParser.java:533)
at jdk.nashorn.internal.parser.JSONParser.expectedError(JSONParser.java:541)
at jdk.nashorn.internal.parser.JSONParser.parseLiteral(JSONParser.java:182)
at jdk.nashorn.internal.parser.JSONParser.parse(JSONParser.java:148)
at jdk.nashorn.internal.runtime.JSONFunctions.parse(JSONFunctions.java:79)
… 207 more

Any idea ? Thanks :slight_smile:


#2

Hi @pvermeil,

I’m sorry but I can’t reproduce the problem. Please share your BPMN process and the body of the complete request.

Best regards,
Philipp


#3

Hi

I’m upping this topic since I’m having the issue again and don’t remember how I solved it. This time I’ll tell it if anyone has this one. So here is my BPMN process. The execution is stuck at the eligibilityResult message task.

I start the process from my PHP app and then send a message containing ‘eligibilityResult’ and the business key, but I’m having the error message :

{
“code”: “ScriptEvaluationException”,
“message”: “Unable to evaluate script: SyntaxError: Invalid JSON: :1:0 Expected json literal but found <\n\n^ in at line number 2”,
“uuid”: “1e486bb059d1bf3f2af68351f4c6a37d”,
“status”: “CANCEL-RUNNING”
}

Check my BPMN. I’m using the procedural PHP SDK for my rest calls.cancelLaunch.bpmn (72.9 KB)

Thanks for reading

update : I intercepted the exact payload sent to the correlate message endpoint :
{“messageName”:“eligibilityResult”,“businessKey”:“cancellaunch-1506932065”}
But despite that the name matches with the task’s name and that the businessKey is correct as you see on the screenshot (and that the above JSON is valid), I keep having this weird message that implies HTML markups. Screen :


#4

Hi @pvermeil,

can you please provide the complete stacktrace of the error?
Do you see any related incidents?

Best regards,
Philipp