JSON error while correlating message by REST

Hello everyone !

I’m running a BPMN where a message task is waiting for a rest call to continue the process, and for this send I use the procedural Camunda PHP SDK. But at the moment of sending my valid JSON payload from my camundaRestClient file to the URL http://localhost:8080/engine-rest/message
I get a 500 error like the following :
{
“type”: “ScriptEvaluationException”,
“message”: “Unable to evaluate script: SyntaxError: Invalid JSON: :1:0 Expected json literal but found <\n
\n^ in at line number 2”
}

My payload was
{“messageName”:“eligibilityResult”,“businessKey”:“cancellaunch-1502369878”}

Any idea for this
markup ? Thanks :confused:
cancelLaunch.bpmn (72.9 KB)

@pvermeil can you recreate the issue using Postman?

Thanks for answering. I had the same error on postman for the message correlate REST call.

The process isn’t stuck, so it goes on with the REST call named cancel Order (rabbit), located in an activity (in another BPMN file). Here it is :
iapCancelOrder.bpmn (7.6 KB)

Next step for me is to recreate this very call.

@pvermeil can you test a different configuration using only a Receive Task and a message name? You bpmn file has “External” Implementation. Are you connecting to camunda to rmq?

@StephenOTT This is a Receive Task issue here, the first one in the BPMN before any RMQ stuff. I ended up testing my message request on RequestBin and here is what I send exactly to Camunda’s message endpoint

What I get when I’m using Postman to reproduce the issue :


I don’t know why a < b r / > markup is reported :confused:

edit : are the messageName and businessKey the only mandatory payload fields for a message call ? Correlate a Message | docs.camunda.org
I don’t meet this issue in my staging environment, only local, given that in staging I have the same payload structure to send message.

BTW I’d like to know if in a Correlate Message request by REST, the correlationKeys and processVariables fields are mandatory. I was just sending messageName and businessKey

https://docs.camunda.org/manual/7.7/reference/rest/message/post-message/

You can send a message with just MessageName.

If I just send the messageName as the payload I have the following error :
{
“code”: “RestException”,
“message”: “org.camunda.bpm.engine.MismatchingMessageCorrelationException: ENGINE-13031 Cannot correlate a message with name ‘eligibilityResult’ to a single execution. 19 executions match the correlation keys: CorrelationSet [businessKey=null, processInstanceId=null, processDefinitionId=null, correlationKeys=null, localCorrelationKeys=null, tenantId=null, isTenantIdSet=false]”,
“uuid”: “dd28a40059a01bb839f794ad10c62e89”,
“status”: “CANCEL-RUNNING”
}

The same happens when I add withoutTenantId true or all to false. :confused:

Hi @pvermeil,

you have to correlate either to one single process instance and add the variables to find this process instance

or

use all=true in the pyaload to correlate to all waiting messages: https://docs.camunda.org/manual/7.7/reference/rest/message/post-message/#request-body

Hope this helps,

Ingo

Hi @Ingo_Richtsmeier
I’ve tried messageName and all=true but with the same < b r / > error

Is businessKey enough to select instance to hit for waiting task, or do I need extra variables anyway ? I’ve tried with one of them, in a correlationKeys field.

But I always get a malformed JSON error, except when I only give messageName. For example :

Only if business key is unique per instance. But that rule must be enforced by you. Multiple instances can share the same businesskey.

Hi @pvermeil,

as you get a script error now, your message correlation should work. Please have a look in the following tasks/listeners.

Cheers, Ingo

@Ingo_Richtsmeier : my process is still stuck at the same point :confused: .

If I enter an irrelevant businessKey in my test payload, I don’t have that < b r / > markup error for my JSON :

So the camunda rest api understands what I want to do, but with an existing businessKey (from my process instance) I have this ScriptEvaluationException

Yes, your problem has nothing to do with message correcation but with a following task, that is executed as the process instance continues.