又没人知道阿里云函数计算为啥我的用 async 会 timeout。。。
資深大佬 : Bonnnnnn 7
上面已经建立了 db connection,之前也有非 async 的试过了,可以用。
module.exports.handler = async (event, context) => {
try{
connection.connect();
const result = await connection.query(‘SELECT * FROM user WHERE id=1’);
connection.end();
callback(null, result);
}
catch(err){
callback(err);
}
}
大佬有話說 (10)