Yes I agree with this
I had this exact issue. I was creating my connection var connection = mysql.createConnection({ ... }); outside of the exports.handler