我认为他们两个都给了我相同的诺言,但后来却不如诺言。它给我“ TypeError:data.then不是一个函数”
try{
await docClient.get(params).promise().then(x => console.log(x));//this one works
const data = await docClient.get(params).promise();
data.then(x =>console.log(x));//this.doesen't
}
catch(err){
console.log(err);
}
功能日志: START RequestId:914e5709-7cf2-4978-9b58-d338ebee52dc版本:$ LATEST 2019-11-08T04:39:22.259Z 914e5709-7cf2-4978-9b58-d338ebee52dc
INFO“事件:事件”
2019-11-08T04:39:22.437Z 914e5709-7cf2-4978-9b58-d338ebee52dc
INFO {项:{名:“鲍勃”,id:“ 12345”,姓:“约翰逊”}}
2019-11-08T04:39:22.487Z 914e5709-7cf2-4978-9b58-d338ebee52dc
INFO TypeError:data.then不是函数
在Runtime.exports.handler(/var/task/index2.js:21:11) 在process._tickCallback(internal / process / next_tick.js:68:7)