https://www.npmjs.com/package/alexa-app-server allows one to run a local express server with a ui for sending utterances, see the request json, and the response json. Would be super helpful so one can iterate locally without having to upload to lambda and test using the developer skill ui.
I completely agree with this. It was a nice tool that Matt Kruse developed (https://github.com/matt-kruse/alexa-app-server) and really helps productivity and ability to debug. It was promoted through the Big Nerd Ranch on-line training demos, but very useful. It would be great to leverage this server with the new skills kit apis.
so two other requests I have (that I can make separate issues if you like):
Can't hurt to ask, right? ;)
Thanks for the suggestions! We take feedback very seriously when planning what to work on next.
One suggestion for managing many states is to name your handler files the same as your state strings and then use a loop. For example, you could have start.js, inProgress.js and end.js each exporting an object.
start.js
module.exports = {
'LaunchRequest': function() {...}
}
And then
index.js
var Alexa = require('alexa-sdk');
var states = ['start', 'inProgress', 'end'];
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
states.forEach(function(state) {
alexa.registerHandlers(Alexa.CreateStateHandler(state, require('./'+state)));
}
alexa.execute();
}
If you want to get fancy you could use the file system module to read all of the filenames in a directory first :)
+1 - I'd love to be able to use this library but I can't make it work locally or in Lambda. I got close to testing locally, but the context value in the entrypoint function appears to have methods on it that the Emitters need. A local test harness would be great.
You can use lambda-local to test locally. Just make sure that your AWS credentials are configured correctly.
I am using a proxy tool to test my skill locally https://github.com/bespoken/bst, dont need to deploy every single time when making changes, and I still use the dyanmodb easily
@jjbskir has written a nice post how to test an Alexa skill with Node.js and Jasmine but he does not seem to use the SDK for Node.js. Can we use a similar method for Alexa Skills which use the SDK?
Here is a tool for testing Alexa skills locally: https://www.npmjs.com/package/alexa-skill-test
I have created a Alexa Skill Starter Template based on the Alexa Skills Kit SDK for Node.js and the Serverless Framework. It uses lambda-local for local debugging, unit, and e2e tests.
https://github.com/rmtuckerphx/alexa-skill-serverless-starter-template
Here are a couple of links that may be of interest to people reading this thread:
https://www.npmjs.com/package/lambda-local
Ultimately, though, I think that alexa-app-server's local testing functionality could use some improvements, but works quite well. There's also an issue posted on that repo seeking a pull request to add alexa-sdk compatibility to it. If someone has the time to figure that out, being able to use alexa-sdk or alexa-app along with alexa-app-server would be a good thing. As is, I think there's a fair chunk of work involved with that, as it seems alexa-sdk is specifically geared towards running in AWS Lambda, but I haven't investigated too thoroughly.
After hours of research, I was finally able to test my alexa skill locally. I thought it would be a good idea to put all the instructions in one place. So here you go:
How can I do the same on Python?
Hey Folks,
We recently published a package - ask-sdk-local-debug that allows you to redirect your skill requests back to your developer machine. It comes with an integration with the new ASK Toolkit for Vscode and is super easy to use. ReadMe instructions, Developer docs
Most helpful comment
Thanks for the suggestions! We take feedback very seriously when planning what to work on next.
One suggestion for managing many states is to name your handler files the same as your state strings and then use a loop. For example, you could have start.js, inProgress.js and end.js each exporting an object.
start.js
And then
index.js
If you want to get fancy you could use the file system module to read all of the filenames in a directory first :)