嗨,我正在尝试使用下面的lambda查询Dynamo DB的代码。
exports.handler = function index(event, context, callback) {
var AWS = require("aws-sdk");
AWS.config.update({
region: "us-west-1"
});
var docClient = new AWS.DynamoDB.DocumentClient();
console.log("Querying ");
var params = {
TableName : "BankApp",
KeyConditionExpression: "#yr = :Value",
ExpressionAttributeValues: {
"#yr": "Test"
},
ExpressionAttributeNames : {
":Value" : {"S" : "TEST" }
}
};
docClient.query(params, function(err, data) {
if (err) {
console.error("Unable to query. Error:", JSON.stringify(err, null, 2));
} else {
console.log("Query succeeded.");
data.Items.forEach(function(item) {
console.log(" -", item.Account_NUM + ": " + item.ACCOUNT_BAL);
});
}
});
}
但是我收到错误提示: 无法查询。错误:{ “ message”:“ ExpressionAttributeNames包含无效的键:语法错误;键:\”:Value \“”, “ code”:“ ValidationException”, “ time”:“ 2018-07-17T15:20:40.308Z”,
答案 0 :(得分:0)
这是我的错误,我使用了错误的区域。