我通过AWS lambda从数据库获取数据时遇到问题。我在Node.js中有代码:
'use strict';
console.log('Loading function');
let doc = require('dynamodb-doc');
let dynamo = new doc.DynamoDB();
exports.handler = (event, context, callback) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
if (event.tableName) {
event.id.TableName = event.tableName;
}
dynamo.getItem(event.id, callback);
callback(null, event.id); // Echo back the first key value
// callback('Something went wrong');
};
使用这样的JSON代码进行测试:
{
"tableName": "Events",
"payload": "dbf943c3-aaac-473d-9c6a-7651280e0f90"
}
我收到错误:
{
"errorMessage": "Process exited before completing request"
}
有谁知道出了什么问题?
PS。我的数据库被称为事件和记录的ID我想得到的是:dbf943c3-aaac-473d-9c6a-7651280e0f90