1
尝试使用AWS Lambda中的Javascript代码进行编码。该代码旨在让Alexa转到一个URL并使用AudioPlayer在那里传输音频。 无法弄清楚我在这段代码中缺少什么,或者它有什么问题,我通过日志得到这个错误。适用于AudioPlayer的AWS Lambda Javascript
代码:
'use strict';
var alexa = require('alexa-sdk');
var APP_ID = "amzn1.ask.skill.b5c95058-7134-4044-9e77-a4279e0adaf7";
var PAUSE_MESSAGE = "paused!";
var RESUME_MESSAGE = "resumed!";
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
var handlers = {
'play': function(audioURL, offsetInMilliseconds) {
var response = {
version: "1.0",
response: {
shouldEndSession: true,
directives: [{
type: "AudioPlayer.Play",
playBehavior: "REPLACE_ALL",
audioItem: {
stream: {
url: 'https://feeds.soundcloud.com/stream/275202399-amazon-web-services-306355661-amazon-web-services.mp3',
offsetInMilliseconds: 10
}
}
}]
}
}
this.context.succeed(response);
},
'AMAZON.PauseIntent': function() {
this.emit(':tell', PAUSE_MESSAGE);
},
'AMAZON.ResumeIntent': function() {
this.emit(':tell', RESUME_MESSAGE);
}
};
{ “的errorMessage”: “找不到模块 '的alexa-SDK'”, “ERRORTYPE”: “错误”, “堆栈跟踪”: “要求(内部/模块.js:20:19)”的“Module.require(module.js:497: “Object。(/ var/task/inde x.js:2:13)“, ”Module._compile(module.js:570:32)“, ”Object.Module._extensions..js(module.js:579:10)“, ”Module .load(module.js:487:32)”, “tryModuleLoad(module.js:446:12)”, “Function.Module._load(module.js:438:3)” ] } –
HTTPS ://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/ – Will