question

matteo13580 avatar image
matteo13580 asked

Input: request: reason: "ERROR" type: INVALID RESPONSE

I am having some trouble finding out where the error is in this program. My Alexa application is running a python script via AWS Lambda. I have strictly been testing in the Amazon Developer Console "Test" tab. When I ask Alexa to open my app called "Lingo Dictionary", I get no problem. However when I get it to respond to one of my custom intents, it gives me an error. A sample Alexa conversation:

[U]ser: open lingo dictionary

[A]lexa: This is Lingo Dictionary... [Successful response]

U: lol

A: There was a problem with the requested skill's response [ERROR]

Another example:

U: ask lingo dictionary lol

A: There was a problem with the requested skill's response [ERROR]


I know that the word "lol" should be able to be processed by Alexa as under the "Build" tab when I go to the "Utterance Profiler", and I put in the command, it is able to match up the correct intent with the correct word.


When I get the errors in the test tab this is the following JSON input:


{

"version": "1.0",

"session": {

"new": false,

"sessionId": "amzn1.echo-api.session.2fd96e27-9092-4424-b613-a7eae9794d3b",

"application": {

"applicationId": "amzn1.ask.skill.6bf5315a-56c9-460c-9090-70bfa1be331f"

},

"user": {

"userId": "amzn1.ask.account.SHORT"

}

},

"context": {

"System": {

"application": {

"applicationId": "amzn1.ask.skill.6bf5315a-56c9-460c-9090-70bfa1be331f"

},

"user": {

"userId": "amzn1.ask.account.SHORT"

},

"device": {

"deviceId": "amzn1.ask.device.SHORT",

"supportedInterfaces": {}

},

"apiEndpoint": "https://api.amazonalexa.com",

"apiAccessToken": "SHORT"

},

"Viewport": {

"experiences": [

{

"arcMinuteWidth": 246,

"arcMinuteHeight": 144,

"canRotate": false,

"canResize": false

}

],

"shape": "RECTANGLE",

"pixelWidth": 1024,

"pixelHeight": 600,

"dpi": 160,

"currentPixelWidth": 1024,

"currentPixelHeight": 600,

"touch": [

"SINGLE"

]

}

},

"request": {

"type": "SessionEndedRequest",

"requestId": "amzn1.echo-api.request.1ec45382-20fb-4fb5-80cd-536f096e5923",

"timestamp": "2019-03-08T21:13:57Z",

"locale": "en-US",

"reason": "ERROR",

"error": {

"type": "INVALID_RESPONSE",

"message": "An exception occurred while dispatching the request to the skill."

}

}

}


When I put this JSON directly into Lambda, I get that my script simply returns null. With no errors present. Then I decided to try and take into account when the request is an error, and now my skill responds to errors. However it is still not working as expected. I am not sure why this would be the JSON that my script should be getting. It should have the intent name, etc, but it is all missing.


How can I go about solving this issue?


alexa skills kitdebuggingresponse
3 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

"An exception occurred while dispatching the request to the skill" mean that there is an issue in the code and it threw an unhandled exception. You need to add some console logs in the intent that is causing the issue and try to figure out what is broken.

If you are using sdk v2 try adding ErrorHandler if you haven't and try printing error there. How to implement the ErrorHandler can be found here and in other skill examples in github.

0 Likes 0 ·

If I input the JSON just as is, I don't get any errors when I run it. I just simply return null which I think would be the correct return given such an input.

I noticed that the ErrorHandler is for js, is there something similar for Python?

0 Likes 0 ·

I see that python has something similar it is only named differently CatchAllExceptionHandler. I would begin by adding it.

Also this is the response json. If you input this, the response will be something random, like null, if I correctly understood what you are trying to do.

0 Likes 0 ·

0 Answers