Barry M
Barry M

Reputation: 21

Basic Alexa Skills

I have downloaded the Alexa Skills online tutorial found at:

https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/reindeerGames/src/index.js

and followed (I think) all of the instructions in the tutorial found at:

https://developer.amazon.com/public/community/post/TxDJWS16KUPVKO/New-Alexa-Skills-Kit-Template-Build-a-Trivia-Skill-in-under-an-Hour

This is meant to be a tutorial for first time Alexa Skills developers. My question is, I get this error message once I hit the "Save and Test" button:

errorMessage": "Exception: TypeError: Cannot read property 'application' of undefined"

Does anyone know what the above error means or how to get rid of it?

Thanks v much.

Upvotes: 2

Views: 2489

Answers (1)

Ron Lisle
Ron Lisle

Reputation: 1164

This looks like a javascript error telling you that you are trying to use a property named application on an undefined variable.

JavaScript assigns the value "undefined" to any variable that you use but haven't set yet.

There are a several ways that you can debug problems in your Lambdas. Perhaps the easiest is to review the Logs. To do this:

  1. Go to the Lambda console (where you upload your code to Lambda)
  2. Select the Monitoring tab
  3. Select "View logs in CloudWatch" (in the upper right)

Review the latest log, looking for a reported error in one of your files (typically index.js) and specifically the line number. That should help you find the error.

Note that the time stamps will be GMT, so probably won't match your actual time. This can be confusing if you have multiple entries. But the minutes should match, helping you verify that you're looking at the correct log entry.

A more advanced, and quicker way to debug Lambda problems, is the include a "test" request, and run this each time you upload code to Lambda.

To set this up:

  1. Run one of your defined utterances in the ASK test page under the "Service Simulator" section.
  2. Copy the code displayed below that in the "Lambda Request" section.
  3. Now switch to the Lambda console for your Lambda function
  4. Click the down arrow in the Actions button and select "Configure test event"
  5. Paste the request you copied above into the text field
  6. Click Save and Test.

Now each time you upload new code to Lambda, you can select "Test" and the request that you just saved will be run.

And best of all, the console log will be displayed in the lower right corner, saving you from having to switch to the logs and refresh to view them.

Upvotes: 5

Related Questions