issue with rest-get connector when status is 204 or 404 or... (empty body)

Description

stacktrace dump:

org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=5711209466255545438 | PROCESS_NAME=XXXXXXXXXXXX | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2064 | ROOT_PROCESS_INSTANCE_ID=2064 | FLOW_NODE_DEFINITION_ID=6247473910900401100 | FLOW_NODE_INSTANCE_ID=40347 | FLOW_NODE_NAME=xxxxxxxxxxxxxxxxxxxxxxxxxx | CONNECTOR_IMPLEMENTATION_CLASS_NAME=xxxxxxxxxxxxxxxxxx | CONNECTOR_INSTANCE_ID=40138 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:191)<br />
at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeOutputOperation(ConnectorServiceDecorator.java:108)<br />
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.evaluateOutput(ExecuteConnectorWork.java:125)<br />
at org.bonitasoft.engine.execution.work.ExecuteConnectorOfActivity.evaluateOutput(ExecuteConnectorOfActivity.java:77)<br />
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:333)<br />
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:1)<br />
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)<br />
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:158)<br />
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:58)<br />
at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit$0(BonitaThreadPoolExecutor.java:90)<br />
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br />
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br />
at java.lang.Thread.run(Thread.java:745)<br />
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:203)<br />
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:121)<br />
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:106)<br />
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:95)<br />
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:188)<br />
... 16 more<br />
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:44)<br />
at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:57)<br />
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:141)<br />
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)<br />
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)<br />
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)<br />
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)<br />
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198)<br />
... 20 more<br />

Environment

None

External Link

None

Workaround

None

Activity

Show:
Antoine Mottier
July 17, 2019, 11:45 AM

I agree that it should not break when response HTTP code is 204 but what would be the expected behavior from your point of view if HTTP response code is 404? I guess that in such situation it is ok to consider that the connector execution failed isn’t it?

Mahboobar Rahman
July 17, 2019, 12:42 PM
Edited

Thanks, Antoine for looking into the case. 404 yes but since Bonita does provide us variables to trap the StatusCode (along with the body, header, etc) while making the REST call, so if all REST call responses are let through irrespective of the StatusCode then it would give the developer an opportunity to handle it accordingly with an appropriate message in the UI. Does the Bonita provided REST component need to Police the traffic or should it just act as an enabler? Your thoughts !!

Delphine Coille
August 2, 2019, 8:20 AM

Hi , your issue related to BS-19299 has been fixed in Bonita 7.9.2 released yesterday. We encourage you to migrate to this version if you want to benefit from the fix.

Mahboobar Rahman
August 2, 2019, 1:05 PM

Thank you Delphine.

Antoine Mottier
September 4, 2019, 12:38 PM

Note that all HTTP status codes higher or equal to 200 and lower then 400 are considered successful. All other status code values will make the connector execution failed.

Meaning that with Bonita standard REST connector implementation it is not possible to deal with HTTP status code for error such as 404 or 500 by testing the connector output {{status_code}}. For such use case, you can either use the BPMN error or create your own implementation of the connector (you can reused the connector source available at: )

Assignee

Antoine Mottier

Reporter

mahboob rahman

Affects versions

Reference

BS-19299

Fix versions

Configure