This project is based on Mulesoft Dataweave and Salesforce to provide secure, reliable, API access for all the Scores apps and projects. It is hosted on Anypoint and acts as the transactional hub, in concert with the authentication API
While executing the POST request to/enrollments, an error occurs due to invalid date values in the payload, yet nothing is returned to the client. The specific error message is as follows:
INFO 2024-05-30 08:46:33,957 [[MuleRuntime].uber.04: [salesforce-data-api-1.0.0-SNAPSHOT-mule-application].post:\enrollments:application\json:salesforce-data-api-config.CPU_LITE @59671307] [processor: entry-flow/processors/0; event: a54acfe0-1e82-11ef-ab40-a07817b1a392] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Request received for POST /api-internal/enrollments - Payload {
"TeamSeasonId": "a0q1T000008JoB4QAK",
"StudentId": "",
"StartDate": "",
"EndDate": ""
}
INFO 2024-05-30 08:46:33,962 [[MuleRuntime].uber.03: [salesforce-data-api-1.0.0-SNAPSHOT-mule-application].post:\enrollments:application\json:salesforce-data-api-config.CPU_INTENSIVE @2816369a] [processor: post:\enrollments:application\json:salesforce-data-api-config/processors/1; event: a54acfe0-1e82-11ef-ab40-a07817b1a392] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Method and Request Path stored as vars: method=POST, request path=/api-internal/enrollments. queryparams={}
ERROR 2024-05-30 08:46:33,967 [[MuleRuntime].uber.04: [salesforce-data-api-1.0.0-SNAPSHOT-mule-application].post:\enrollments:application\json:salesforce-data-api-config.CPU_INTENSIVE @2816369a] [processor: ; event: a54acfe0-1e82-11ef-ab40-a07817b1a392] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler:
********************************************************************************
Message : "Cannot coerce String to Date, caused by: Text '' could not be parsed at index 0
7| (Start_Date__c: payload.StartDate as Date {format: 'yyyy-MM-dd'}) if payload.StartDate != null,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Trace:
at anonymous::main (line: 7, column: 18)" evaluating expression: "%dw 2.0
output application/java
---
[{
Contact__c: payload.StudentId,
Team_Season__c: payload.TeamSeasonId,
(Start_Date__c: payload.StartDate as Date {format: 'yyyy-MM-dd'}) if payload.StartDate != null,
(End_Date__c: payload.EndDate as Date {format: 'yyyy-MM-dd'}) if payload.EndDate != null
}]".
Element : post:\enrollments:application\json:salesforce-data-api-config/processors/2 @ salesforce-data-api-1.0.0-SNAPSHOT-mule-application:enrollments.xml:276 (Create Request)
Element DSL : <ee:transform doc:name="Create Request" doc:id="1f1221b0-bd99-4433-be65-5159dd3955a6">
<ee:message>
<ee:set-payload><![CDATA[
%dw 2.0
output application/java
---
[{
Contact__c: payload.StudentId,
Team_Season__c: payload.TeamSeasonId,
(Start_Date__c: payload.StartDate as Date {format: 'yyyy-MM-dd'}) if payload.StartDate != null,
(End_Date__c: payload.EndDate as Date {format: 'yyyy-MM-dd'}) if payload.EndDate != null
}]
]]></ee:set-payload>
</ee:message>
</ee:transform>
Error type : MULE:EXPRESSION
FlowStack : at post:\enrollments:application\json:salesforce-data-api-config(post:\enrollments:application\json:salesforce-data-api-config/processors/2 @ salesforce-data-api-1.0.0-SNAPSHOT-mule-application:enrollments.xml:276 (Create Request))
at salesforce-data-api-main(salesforce-data-api-main/processors/0 @ salesforce-data-api-1.0.0-SNAPSHOT-mule-application:main-api.xml:13)
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
ERROR 2024-05-30 08:46:33,968 [[MuleRuntime].uber.04: [salesforce-data-api-1.0.0-SNAPSHOT-mule-application].post:\enrollments:application\json:salesforce-data-api-config.CPU_INTENSIVE @2816369a] [processor: ; event: a54acfe0-1e82-11ef-ab40-a07817b1a392] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler:
********************************************************************************
Message : "Cannot coerce String to Date, caused by: Text '' could not be parsed at index 0
7| (Start_Date__c: payload.StartDate as Date {format: 'yyyy-MM-dd'}) if payload.StartDate != null,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Trace:
at anonymous::main (line: 7, column: 18)" evaluating expression: "%dw 2.0
output application/java
---
[{
Contact__c: payload.StudentId,
Team_Season__c: payload.TeamSeasonId,
(Start_Date__c: payload.StartDate as Date {format: 'yyyy-MM-dd'}) if payload.StartDate != null,
(End_Date__c: payload.EndDate as Date {format: 'yyyy-MM-dd'}) if payload.EndDate != null
}]".
Element : (None)
Element DSL : (None)
Error type : MULE:EXPRESSION
FlowStack : (None)
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Steps to Reproduce:
Make a POST request to /enrollments with wrong payload:
Description:
While executing the POST request to
/enrollments
, an error occurs due to invalid date values in the payload, yet nothing is returned to the client. The specific error message is as follows:Steps to Reproduce:
Make a POST request to
/enrollments
with wrong payload:Expected Behavior:
The application should handle invalid date values a meaningful error message to the client.