Closed Dallanosm closed 6 years ago
This workaround works for me:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
// Initialize the Alexa SDK
var Alexa = require('alexa-sdk');
app.use(bodyParser.json());
app.post('/', function(req, res) {
// Build the context manually, because Amazon Lambda is missing
var context = {
succeed: function (result) {
console.log(result);
res.json(result);
},
fail:function (error) {
console.log(error);
}
};
// Delegate the request to the Alexa SDK and the declared intent-handlers
var alexa = Alexa.handler(req.body, context);
alexa.registerHandlers(handlers);
alexa.execute();
});
Cheers,
Sascha.
Thanks @wolter
Thanks @wolter ! That worked perfectly. Just out of curiosity, do you know the standard context functions look like? I couldn't find any documentation from Amazon on the context object and logging it didn't really help much.
@kyle-wrenn here you go https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
Is there yet another workaround for the v2 ask-sdk?
Same question as @maegnes. Is there a workaround for ASK SDK v2 for node.js? My code:
const express = require('express');
const bodyParser = require('body-parser');
const alexa = require('ask-sdk-core');
const verifier = require('alexa-verifier-middleware');
const handlers = require('./handlers');
const port = 3000;
const path = '/laborsteuerung';
const app = express();
app.get('/', (req, res) => {
res.send('Online');
});
app.post(path, verifier, bodyParser.json(), function (req, res) {
// Alexa code here
})
app.listen(port, () => {
console.log('Server listening on port ' + port + '!');
});
NEVERMIND I found the answer here https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/362#issuecomment-384686134
Hello,
This issue has been opened and closes several times, but we don't have any solution:
In this repo we have the issue: Using this without Lambda
Here we have: #72 and #200 but not resolved yet.
We want use the alexa skill without lambda, could be this possible?
Best regards, Daniel.