Search code examples
aws-lambdaalexa-skills-kit

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


Solution

  • 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