0
votes

I have followed a tutorial to get this working. My Alexa skill is built with invocation, intents and utterances set up. My Lambda function is set up.

My endpoints default region is:

arn:aws:lambda:us-east-1:(myID found in AWS Support Center ):function:myLearn

myLearn function in Lambda is set with Alexa Skills Kit which has my correct Skill ID copied from the skill.

My HelloIntent doesn't have a slot. I'm just trying to get a response from the invocation.

My code running node.js 6.10 with a handler called index.handler follows as this:

var Alexa = require("alexa-sdk");

var handlers = {
  "HelloIntent": function () {
    this.response.speak("Hello, It's Me."); 
    this.emit(':responseReady');
  },
  "LaunchRequest": function () {
    this.response.speak("Welcome to my thing I got going on."); 
    this.emit(':responseReady');
  }
};

exports.handler = function(event, context, callback){
  var alexa = Alexa.handler(event, context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};

I've read that there are issues with zips but I didn't upload anything - I just changed the default index.js file...and my handler isn't named anything different - it's index.handler.

When I run the test in the alexa console I get the ol: "There was a problem with the requested skill's response"

My json output is null.

And when I go to my logs in Cloud Watch:

Unable to import module 'index': Error at Function.Module._resolveFilename

I did a search for this and many of the errors were how users uploaded the zips and there was a conflict with the handler name and js file.

2

2 Answers

1
votes

It looks like you might have created the Lambda function from the AWS Console and not included the alexa-sdk. To fix this you can start by using one of the provided 'Alexa blueprints' that include the alexa-sdk then overwrite the code in the Lambda with your code. Or you can package your code in a .zip file that includes the alexa-sdk module and upload the package through the web console. Here is a video I did a while back that explains the issue https://youtu.be/cFzAIhsldbs - I'm pretty sure that's your problem. I hope this helps.

0
votes

You can try using "speechOutput" variable to store your response and then use the emit function.