AppSync Mock - Unable to convert document to class ...LambdaVersionedConfig.
Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug
On [email protected] this request mapping template works
#**
The value of 'payload' after the template has been evaluated
will be passed as the event to AWS Lambda.
*#
{
"version" : "2017-02-28",
"operation": "Invoke",
"payload": {
"arguments": $util.toJson($context.args),
"field": "changeUser",
}
}
however on the current version is not working.
Amplify CLI Version [email protected]
To Reproduce Example provided in the description
Expected behavior Should Invoke lambda data source
Desktop (please complete the following information):
- OS: Mac
- Node Version. v10.15.3
@NeillGiraldo what error message do you see when you try this?
Hi @nikhname, This is the error that is being thrown.
{
"data": {
"changeUser": null
},
"errors": [
{
"message": "Unable to convert {\n \"version\" : \"2017-02-28\",\n \"operation\": \"Invoke\",\n \"payload\": {\n \t\"arguments\": {\"username\":\"changedUser\"},\n \"field\": \"changeUser\",\n }\n} to class com.amazonaws.deepdish.transform.model.lambda.LambdaVersionedConfig.",
"errorType": "MappingTemplate",
"data": null,
"errorInfo": null,
"path": [
"changeUser"
],
"locations": [
{
"line": 6,
"column": 3,
"sourceName": "GraphQL request"
}
]
}
]
}
Hi @nikhname , I checked a bit deeper and it was because of the trailing comma at the end of the payload. JSON.parse was failing because of it.
This applies to all my previous Mapping Templates.
We do strict evaluation of the JSON which is the recommended practice. Let us know if you're still stuck with this.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.