Coder
Coder

Reputation: 3262

Deserialization error in amazon lex response

I have connected Amazon Lex with Amazon Lambda, I tested Amazon Lambda and it is working as expected.

I get the below response from Amazon Lambda (tested using cloud watch) :

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

but I get the below error from amazon lex : What could be the issue here?

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]

Could someone let me know the issue?

Thanks,
Harry

Upvotes: 0

Views: 113

Answers (1)

Joey Kilpatrick
Joey Kilpatrick

Reputation: 1602

When the response type is ElicitSlot, Lex expects to see a message field like this:

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

Your response is a string, not an object. See here for more info.

Upvotes: 1

Related Questions