4
votes

Firstly, If I use the Simulator on the alexa app development page everything works fine, although the request looks some what different. If I say to my Alexa Device "Ask appName {x} and {y}" then my web service gets called with a error message "An exception occurred while dispatching the request to the skill". {X} and {Y} are my intent slots.

This only happens when talking directly to Alexa and again the Simulator works perfectly.

Below is the request I receive when I talk to my Amazon Echo.

{
    "version": "1.0",
    "session": {
        "new": false,
        "sessionId": "amzn1.echo-api.session.6a13f2db-a9f6-43a9-bc4d-x063b86905b6c",
        "application": {
            "applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9xc94abba2"
        },
        "user": {
            "userId": "xxx"
        }
    },
    "context": {
        "AudioPlayer": {
            "playerActivity": "STOPPED"
        },
        "System": {
            "application": {
                "applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9c94abba2"
            },
            "user": {
                "userId": "xxxx"
            },
            "device": {
                "deviceId": "xx",
                "supportedInterfaces": {
                    "AudioPlayer": {}
                }
            },
            "apiEndpoint": "https://api.eu.amazonalexa.com",
            "apiAccessToken": "xxxx"
        }
    },
    "request": {
        "type": "SessionEndedRequest",
        "requestId": "amzn1.echo-api.request.2a993410-e7a8-4f37-87d7-a5063ef185b5",
        "timestamp": "2017-12-22T00:11:45Z",
        "locale": "en-GB",
        "reason": "ERROR",
        "error": {
            "type": "INVALID_RESPONSE",
            "message": "An exception occurred while dispatching the request to the skill."
        }
    }
}

Below is my intent Schema

{
  "intents": [
    {
      "intent": "StartGameIntent"
    },
    {
      "slots": [
        {
          "name": "playerOne",
          "type": "AMAZON.US_FIRST_NAME"
        },
        {
          "name": "playerTwo",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayTheGame"
    },
    {
      "intent": "StopTheGame"
    },
    {
      "slots": [
        {
          "name": "damage",
          "type": "AMAZON.NUMBER"
        },
        {
          "name": "player",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayerTakesDamage"
    },
    {
      "slots": [
        {
          "name": "health",
          "type": "AMAZON.NUMBER"
        },
        {
          "name": "player",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayerHeals"
    }
  ]
}

It works fine if I ask an Intent without any slots. Why is it not finding my intents when they have slots?

I'm running this app with Language UK.

3

3 Answers

2
votes

I ended up creating two languages, UK and US, and then I used the new skill builder making sure I saved and built model after I'd finished editing/adding my intents and sample utterances.

enter image description here

I also used a different slot type, instead of AMAZON.US_FIRST_NAME I used AMAZON.GB_FIRST_NAME .

Below is a screenshot of the settings of my skill builder page I used to get my Alexa skill working

Just to point out this was a problem with the interaction mode, the new builder which is currently in beta seemed to resolve this for me.

enter image description here

1
votes

Try checking the AWS lambda log for errors with the request. It should give you the failing module name (eg. index.js) and line number of an exception.

You can also add console.log() messages to your lambda code to help narrow down where the error is occurring.

0
votes

Please check whether your skill's (lambda method) responds within allowed time (7-10 seconds).