可能跟 这个问题有关,  
我也遇到这个问题:  
“Cannot enqueue Query after invoking quit”  
请问 怎么改 插件的 代码 参考:解决方法: https://forums.aws.amazon.com/thread.jspa?threadID=223230  
const query = function(sql, values) { return new Promise((resolve, reject) => { connection.query(sql, values, (error, results, fields) => { if (error) { reject(error) } else { resolve(results) } }) }) }  
//This is your handler. exports.handler=function(event, context) { //This is declared inside the handler: it is guaranteed to never be reused!. var connection=function_that_gets_your_connection();  
//Do things with your connection.
var query_string='SELECT something FROM nothing WHERE value=?';  
connection.query(query_string, [beware], function(res, err){  
//Check for errors, disconnect and exit with failure.  
if(err){  
    console.log("Query failed", err);  
    connection.end(function(err){  
        context.fail(0);  
    });  
}  
//Disconnect and exit with success.  
else{  
    connection.end(function(err){  
        if(err){  
            console.log("Warning: disconnection failed"; err);  
        }  
        context.succeed(res);  
    });  
}  
});
}  
diamont1001@163.com
2020-08-01  
query 这个方法有点问题:  
另外,我遇到了一个问题,50%的机率会报这个错“Cannot enqueue Query after invoking quit”,解决方法: https://forums.aws.amazon.com/thread.jspa?threadID=223230
                                        
                                     
1 个回复
LikeU恋爱交友 (作者) - LikeU恋爱交友
可能跟 这个问题有关,
我也遇到这个问题:
“Cannot enqueue Query after invoking quit”
请问 怎么改 插件的 代码 参考:解决方法: https://forums.aws.amazon.com/thread.jspa?threadID=223230
const query = function(sql, values) { return new Promise((resolve, reject) => { connection.query(sql, values, (error, results, fields) => { if (error) { reject(error) } else { resolve(results) } }) }) }
//This is your handler. exports.handler=function(event, context) { //This is declared inside the handler: it is guaranteed to never be reused!. var connection=function_that_gets_your_connection();
//Do things with your connection.
var query_string='SELECT something FROM nothing WHERE value=?';
connection.query(query_string, [beware], function(res, err){
});
}
diamont1001@163.com
2020-08-01
query 这个方法有点问题:
另外,我遇到了一个问题,50%的机率会报这个错“Cannot enqueue Query after invoking quit”,解决方法: https://forums.aws.amazon.com/thread.jspa?threadID=223230