AlexaスキルからトリガされるLambda関数からIoTトピックにパブリッシュしようとしています。ラムダ関数の中で、私はこれのIoTが公開やってる:私はラムダ関数でこのコード(とのみ、このコードを)実行した場合AWS:AlexaスキルテンプレートのintentHandler.call()は先行する関数呼び出しをキャンセルします
var params = {
topic: 'testTopic',
payload: new Buffer('test message'),
qos: 1
};
iotData.publish(params, function(err, data) {
if (err) console.log('ERR: ', err); // an error occurred
else if (data) console.log('DATA: ', data); // successful response
});
、それが正常に動作します。しかし、私がAlexa SkillテンプレートのonIntent関数にparamsとpublish関数を入れて、それを新しいラムダ関数に入れると、それは機能しません。 (両方のラムダ関数が同じ設定とポリシーを持っています)
intentHandler.call()をコメントアウトすると、iotData.publish()が実行されるため、intentHandler呼び出しが何らかの理由でキャンセルするように見えます理解していない。
onIntent: function (intentRequest, session, response) {
var intent = intentRequest.intent,
intentName = intentRequest.intent.name,
intentHandler = this.intentHandlers[intentName];
if (intentHandler) {
console.log('dispatch intent = ' + intentName);
var params = {
topic: 'testTopic',
payload: new Buffer('test message'),
qos: 1
};
iotData.publish(params, function(err, data) {
if (err) console.log('ERR: ', err); // an error occurred
else if (data) console.log('DATA: ', data); // successful response
});
intentHandler.call(this, intent, session, response);
} else {
throw 'Unsupported intent = ' + intentName;
}
}