stevemoneymaker avatar image
stevemoneymaker asked

Issues with Modifying Space Geek Sample App - Can you look at my code?

Hello I just began to play around with the Alexa Skills samples that are available. I have found that if I publish the samples as is the App launches on Echo. If I change the names and utterances to something other then what is listed the App will not launch. I get the following response from Echo "there was a problem with the requested skills response." Can you look at my code and comment? Thank you! /** Copyright 2014-2015, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * This simple sample has no external dependencies or session management, and shows the most basic * example of how to create a Lambda function for handling Alexa Skill requests. * * Examples: * One-shot model: * User: "Alexa, ask christmas Geek for a christmas fact" * Alexa: "Here's your christmas fact: ..." */ /** * App ID for the skill */ var APP_ID = undefined; //replace with "[your-unique-value-here]"; /** * Array containing christmas facts. */ var CHRISTMAS_FACTS = [ “Santa is Jolly.”, “Mrs Santa is Jolly.”, “Elves are Jolly.”, “Snow is Cold.”, “Christmas comes but once a year.”, “Rudolph’s nose is bright.”, “Santa loves cookies.”, “Christmas is fun.”, “Christmas cheer for everyone.”, “Christmas arrives but once a year.”, “Presents appear under the tree.”, “Santa loves his elves.”, “Good Cheer to one and all.” ]; /** * The AlexaSkill prototype and helper functions */ var AlexaSkill = require('./AlexaSkill'); /** * christmasGeek is a child of AlexaSkill. * To read more about inheritance in JavaScript, see the link below. * * @see */ var ChristmasGeek = function () {, APP_ID); }; // Extend AlexaSkill ChristmasGeek.prototype = Object.create(AlexaSkill.prototype); ChristmasGeek.prototype.constructor = ChristmasGeek; ChristmasGeek.prototype.eventHandlers.onSessionStarted = function (sessionStartedRequest, session) { console.log(“ChristmasGeek onSessionStarted requestId: " + sessionStartedRequest.requestId + ", sessionId: " + session.sessionId); // any initialization logic goes here }; ChristmasGeek.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) { console.log(“ChristmasGeek onLaunch requestId: " + launchRequest.requestId + ", sessionId: " + session.sessionId); handleNewFactRequest(response); }; /** * Overridden to show that a subclass can override this function to teardown session state. */ ChristmasGeek.prototype.eventHandlers.onSessionEnded = function (sessionEndedRequest, session) { console.log(“ChristmasGeek onSessionEnded requestId: " + sessionEndedRequest.requestId + ", sessionId: " + session.sessionId); // any cleanup logic goes here }; ChristmasGeek.prototype.intentHandlers = { GetNewFactIntent: function (intent, session, response) { handleNewFactRequest(response); }, HelpIntent: function (intent, session, response) { response.ask("You can ask Christmas Geek tell me a christmas fact, or, you can say exit... What can I help you with?", "What can I help you with?"); } }; /** * Gets a random new fact from the list and returns to the user. */ function handleNewFactRequest(response) { // Get a random christmas fact from the christmas facts list var factIndex = Math.floor(Math.random() * Christmas_FACTS.length); var fact = Christmas_FACTS[factIndex]; // Create speech output var speechOutput = "Here's your Christmas fact: " + fact; response.tellWithCard(speechOutput, “ChristmasGeek", speechOutput); } // Create the handler that responds to the Alexa Request. exports.handler = function (event, context) { // Create an instance of the ChristmasGeek skill. var christmasGeek = new ChristmasGeek(); christmasGeek.execute(event, context); }; *********************** { "intents": [ { "intent": "GetNewFactIntent", "slots": [] }, { "intent": "HelpIntent", "slots": [] } ] } ************************ GetNewFactIntent a fact GetNewFactIntent a christmas fact GetNewFactIntent tell me a fact GetNewFactIntent tell me a christmas fact GetNewFactIntent give me a fact GetNewFactIntent give me a christmas fact GetNewFactIntent tell me trivia GetNewFactIntent tell me a space trivia GetNewFactIntent give me trivia GetNewFactIntent give me a christmas trivia GetNewFactIntent give me some information GetNewFactIntent give me some christmas information GetNewFactIntent tell me something GetNewFactIntent give me something
alexa skills kitdebugging
10 |5000

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

1 Answer

Nick Gardner avatar image
Nick Gardner answered
Before I take a look at your code, I'll give a few suggestions on testing for Alexa skills hosted in Lambda. The general idea with the Lambda/ASK testing process is to take one step farther removed from the original code every time you deem your test successful. In order, it will typically look like this: 1. Test your code using the built-in Lambda tester 2. Test your code using the service simulator 3. Test your code on an Echo or other Alexa device Since each of these steps gets gradually more restrictive, doing it in that order will make it most likely that you will catch errors early. If you are getting an error when testing directly from Lambda, you will almost certainly get errors when attempting to test on an Echo or using the Service simulator. Using Lambda testing and the service simulator also allow you to remove certain testing variables from the equation and simply test the code, such as voice recognition and construction of the intent. Which step is your code failing on, and what, if any, error messages do you receive when trying to run it? Thanks, Nick
10 |5000

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