amazon lex 响应中的反序列化错误

Deserialization error in amazon lex response

我已将 Amazon Lex 与 Amazon Lambda 连接,我测试了 Amazon Lambda,它按预期工作。

我从 Amazon Lambda 得到以下响应(使用云观察测试):

 {'sessionAttributes': {}, 'dialogAction': {'type': 'ElicitSlot', 'intentName': 'paymentdue', 'slots': {}, 'slotToElicit': '', 'message': 'This is a test message', 'responseCard': '', 'fulfillmentState': 'Fulfilled'}}

但我从 amazon lex 收到以下错误:这里可能是什么问题?

An error has occurred: Invalid Lambda Response: Received invalid response from Lambda: 
Can not construct instance of Message: no String-argument constructor/factory method to deserialize from String value 
('This is a test message') at [Source: {"sessionAttributes": {}, "dialogAction": {"type": "ElicitSlot", "intentName": "paymentdue", "slots": {}, "slotToElicit": "", "message": "This is a test message", "responseCard": "", "fulfillmentState": "Fulfilled"}}; line: 1, column: 138]

有人可以告诉我这个问题吗?

谢谢,
哈利

当响应类型为 ElicitSlot 时,Lex 希望看到这样的 message 字段:

"message": {
      "contentType": "PlainText or SSML or CustomPayload",
      "content": "Message to convey to the user. For example, What size pizza would you like?"
    }

您的回复是一个字符串,而不是一个对象。有关详细信息,请参阅 here