【发布时间】:2020-10-13 19:20:43
【问题描述】:
我在使用无服务器的 Lambda 函数上使用 DynamoDB 和 nodeJS。 当我从本地计算机扫描项目时它可以工作,但是当我部署我的功能扫描时没有响应。没有错误
const docClient = new AWS.DynamoDB.DocumentClient({
apiVersion: "2012-08-10",
});
const checkApiKey = async (apiKey, ) => {
try {
log.debug("before scan");
let result = await docClient
.scan({
"MY_TABLE",
FilterExpression: "#apiKey = :apiKey",
ExpressionAttributeNames: {
"#apiKey": "apiKey",
},
ExpressionAttributeValues: { ":apiKey": apiKey },
})
.promise();
log.debug("after scan");
} catch (error) {
log.error("Can not get dynamo object", { message: error.message });
throwError(error);
}
};
当我在 AWS 上调用此函数时,我可以在日志中看到 before scan,但我没有看到 after scan 也没有看到来自 catch 的错误消息。
像“create”这样的 DynamoDB 操作可以正常工作。
我这几天一直在寻找解决方案...没有成功
【问题讨论】:
标签: amazon-dynamodb serverless-framework aws-sdk-nodejs