Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda Alex Skill session attribute is undefined

I am getting this error in Lambda while trying to upload my files,

{
 "errorMessage": "Cannot read property 'application' of undefined",
"errorType": "TypeError",
"stackTrace": [
"AlexaSkill.execute (/var/task/AlexaSkill.js:83:62)",
"exports.handler (/var/task/index.js:170:10)"
]
}

Looks like from line 83 of AlexaSkill.js:

console.log("session applicationId: " + event.session.application.applicationId);

the session attribute is undefined. Not really sure what's causing

like image 806
SilentDev Avatar asked Dec 12 '16 20:12

SilentDev


People also ask

Where to find skill ID Alexa?

Add an Alexa Skills Kit trigger Open or create your skill in the developer console. Find the skill in the list and click View Skill ID below the skill name. Copy the ID from the popup.

How do you fix there was a problem with the requested skill's response?

One simple way to debug this issue is copying the input JSON from Alexa skill simulator and paste it in the lambda's configure test events. Now run test and it'll generate all the error logs in the lambda itself, for your easy reference.

How do I keep my Alexa skill Open?

In your response, when calling buildSpeechletResponse , set shouldEndSession to false in order to keep the session open and keep listening for more utterances without needing to launch the skill again using "alexa ask MyApp..."

What is an Alexa Speechlet?

Speechlet class is the most important class in Alexa echo system. It controls all the conversation between the Alexa device and the user. It takes user input and invokes the programs which perform the actions asked by the user.


1 Answers

I have figured it out using my sherlock holmes-like skills obtained from excessive mistakes made, Go into your aws lambda account, go to your function, Since you've uploaded the code, click the actions->configure test event->select "Alexa start session" from sample event template, and in the bottom, click save and test button, there, it works :)

If you found this answer to solve your question, please give a tick for my answer

like image 81
Vishwanth Iron Heart Avatar answered Oct 19 '22 12:10

Vishwanth Iron Heart