DynamoDB GetItem调用在函数

时间:2018-01-27 00:08:05

标签: node.js aws-lambda amazon-dynamodb

在尝试读取节点JS函数中的dynamo db表时遇到有线问题

function handleTestRequestQueen(intent, session, callback) {
    var params = {
        TableName: "mysk",
        Key: {
            "name": {
                "S": "la"
            }
        }
    };

    ddb.getItem(params, function(err, data) {
        if (err) console.log(err, err.stack); // an error occurred
        console.log(data);
        callback(session.attributes, buildSpeechletResponseWithoutCard("I am the queen!!", "", ""));

    });
    //  callback(session.attributes, buildSpeechletResponseWithoutCard("I am the queen!!" + result, "", "")); 
}

当我从params中删除Key代码正在执行并失败。

当我保持上面定义的参数时,我得到:意图无效。

我尝试使用一个函数运行一个Lambda代码,它可以正常工作

 var params = {
    TableName: "mysk",
    Key: {
        "name": {
            "S": "la"
        }
    }
};

ddb.getItem(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    console.log(data);
    callback(session.attributes, buildSpeechletResponseWithoutCard("I am the queen!!", "", ""));

});

代码中是否存在语法或逻辑错误?

0 个答案:

没有答案
相关问题