Ошибка десериализации в ответе amazon lex

Я подключил 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]

Может ли кто-нибудь сообщить мне о проблеме?

Спасибо,
Гарри


person Harry    schedule 24.09.2019    source источник


Ответы (1)


Когда тип ответа ElicitSlot, Лекс ожидает увидеть message поле вроде этого:

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

Ваш ответ - это строка, а не объект. См. здесь для получения дополнительной информации.

person Joey Kilpatrick    schedule 24.09.2019