exports.handler = async (event,context,callback) => {
await FIREhose.putRecord(params).promise();
return null;
};
使用回调方法:
exports.handler = (event,context,callback) => {
// code goes here.
FIREhose.putRecord(params)
.promise();
.then((data) => {
// do stuff with data.
// n.b. you could have used the cb instead of a promise here too.
callback(null, null); // or whatever result.
});
};
(还有第三种方法
context.
但这是一个错误
这一切都是由于lambda如何工作,并检测何时有响应。
undefined
)所以没有什么可等待的,它会立即返回-很可能在putRecord调用完成之前。
当你使用
callback
不过,你明确告诉lambda你用的是“旧”方式。有趣的是
回拨
完成节点的事件循环(默认情况下)。也就是说
.putRecord