Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (19.1k points)

I'm trying to use mysql2 to connect to an RDS MySQL instance. When I use the package locally, everything works fine. However, when I use it inside an AWS Lambda function, I get this cryptic error:

TypeError: f.ClientHandshake is not a constructor

at new g (/var/task/index.js:275:62824)

at new o (/var/task/index.js:275:224046)

at e.exports.getConnection (/var/task/index.js:275:218705)

at e.exports.execute (/var/task/index.js:275:220197)

at /var/task/index.js:275:372341

at new Promise (<anonymous>)

at c.execute (/var/task/index.js:275:372308)

at /var/task/index.js:357:14189

at E (/var/task/index.js:316:24416)

at Generator._invoke (/var/task/index.js:316:24204)

Any idea what the issue is? I'm confident that the roles/security groups are all configured correctly.

1 Answer

0 votes
by (44.4k points)

This can be done by updating the webpack.config.js to include

 

optimization: {

    // We no not want to minimize our code.

    minimize: false

},

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories

...