Amazon LEX throwing error while communicating with Lambda

17 Views Asked by At

I have been struggling to integrate a logic in LEX using lambda from the past 3 days and it keeps on throwing me the same error. I have read the AWS documentation for the Lex V2 and have (to the best of my ability) implemented the same in my response logic. The error message is as follows :

Invalid Lambda Response: Received invalid response from Lambda: Cannot construct instance of `IntentResponse`, problem: The validated object is null at [Source: (String)"{"dialogAction": {"type": "Close", "fulfillmentState": "Fulfilled"}, "intent": {"name": "Number_Route", "confirmationState": "Confirmed", "state": "Fulfilled"}, "messages": [{"contentType": "PlainText", "content": "Your number is: 123-456-7890"}]}"; line: 1, column: 245]

I tried this as my response format is :

answer = {
      "dialogAction": {
        "type": "Close",
        "fulfillmentState": "Fulfilled",
      },
      "intent": {
        "name": intent,
        "confirmationState": "Confirmed",
        "state": "Fulfilled",
      },
      "messages": [
        {
          "contentType": "PlainText",
          "content": f"Your number is: {formatted_number}",
        }
      ],
    }
    return answer

Thanks in advance

0

There are 0 best solutions below