2
votes

I defined a skill model using Interaction Model Builder Beta on Amazon developer console. I have also defined a simple lambda function using AWS Lambda;

'use strict';

console.log('Loading function');

exports.handler = (event, context, callback) => {
    console.log('Received event:', JSON.stringify(event, null, 2));    
    callback(null, "Hello world");
};

In the testing part I enter a utterance, I can see a JSON request being created but the response is :

The remote endpoint could not be called, or the response it returned was invalid.

I took the request JSON and created a test for my function in AWS Lambda. The test passes successfully and returns "hello world" for the request.

The trigger for my function is "Alexa Skills Kit". The function logs arent showing anything.

Any idea why it doesnt work? Is there some sort of authentication issue? Do I need to flick a switch somewhere?

The ARN address I use looks like this is arn:aws:lambda:eu-west-1:481045208193:function:eventCount.

2

2 Answers

1
votes

Your Lambda handler needs to have a dependency to the alexa-sdk.

For example

import Alexa from 'alexa-sdk';

export const handler = (event, context, callback) => {
    const alexaHandler = Alexa.handler(event, context, callback);
    alexaHandler.appId = 'amzn1.ask.skill.XXX';
    alexaHandler.registerHandlers(
        // DEFINE YOUR HANDLERS HERE
    );
    alexaHandler.execute();
};

For more informations and examples take a look here: Alexa Skills Kit SDK for Node.js

0
votes

You can certainly create node.js skills without using the Alexa SDK. this is the link to a github gist for a live skill called "counting cards" that does not use the SDK.

From my experience the Service Simulator in the Alexa Developer Console is full of bugs. If your function works on Lambda after copying in the JSON created by the Service Simulator then the "arn" is probably ok.
Have you tried invoking your skill using an actual Amazon Alexa or Amazon Echo? You may be surprised to find that your skill actually works.

Your arn is fine as the Alexa Skill Kit is supported in US-N.Virginia and EU-Ireland.