1

Using a validation hook for AWS lex. If i try to elicit slot, lex fails with:

An error has occurred: Invalid Lambda Response: Lambda response elicited for an invalid slot name ​

Below is my lex event and response from my lambda function. I have 2 slots, topping and crust. Topping was the first slot already given by client. Crust was the missing slot.

I have reviewed most of AWS documentation, stackoverflow and other tutorials but I can't seem to break past this..anyone have any idea?

LexEvent:

{
    "messageVersion": "1.0",
    "invocationSource": "DialogCodeHook",
    "userId": "cbzn2ql6dl59dro",
    "sessionAttributes": {},
    "outputDialogMode": "Text",
    "currentIntent": {
        "name": "Pizza",
        "slots": {
            "topping": "Chicken"
        },
        "confirmationStatus": "None"
    },
    "bot": {
        "name": "PizzaMaker",
        "alias": "$LATEST",
        "version": "$LATEST"
    }
}

Response from Lambda

{
    "sessionAttributes": {},
    "dialogAction": {
        "type": "ElicitSlot",
        "message": {
            "contentType": "PlainText",
            "content": "What type of crust do you want?"
        },
        "intentName": "Pizza",
        "slotToElicit": "​Curst",
        "slots": {
            "topping": "Chicken"
        }
    }
}
Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
Raj Singh
  • 13
  • 3
  • Forgot to add, I verified slot names are matching in lex and lambda (upper and lowercase too). The slot configuration is 1 prompt and 1 response card with options. No Slot Obfucation – Raj Singh May 28 '20 at 01:14

2 Answers2

1

The error "Lambda response elicited for an invalid slot name" is specifically saying that the slot you are trying to elicit with "slotToElicit" does not match a slot configured in your bot.

It may be this typo that is causing the problem: "slotToElicit": "​Curst",

Try "slotToElicit": "​Crust", or lowercase "slotToElicit": "​crust",

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32
1

I tried validating your Lambda response structure using JSONLint and noticed that there is an additional symbol included in the value for the slotToElicit key which is otherwise invisible. This would point to why Lex is unable to find the slot name.

Paradigm
  • 1,876
  • 1
  • 12
  • 16