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
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.
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.
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..."
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With