This question is a follow up question, the link to the other question is -- aws lambda function async connection query
I am developing server code using AWS Lambda and to test the asynchronous connection I am using the same code provided by Trung with improvement by giankotarola and the output of the Lambda Function comes only if I replace --
1. return callback(null, {body: JSON.stringify(result),statusCode:200});
with --
2. return result;
Also, at the following line --
3. pool.getConnection((err, connection) => {
It gives a warning: Expected Error to be handled
I cannot understand why the code at Line 1. mentioned above doesn't work ? And how to handle the warning at 3.