sidorares / node-mysql2

:zap: fast mysqljs/mysql compatible mysql driver for node.js
https://sidorares.github.io/node-mysql2/
MIT License
3.94k stars 592 forks source link

True negative: ssl-mode query params in connectionString considered as invalid #2610

Open davidkhala opened 3 weeks ago

davidkhala commented 3 weeks ago

When I tried to create connection by raw connection string

...
mysql.createConnection(`mysql://avnadmin:${password}@mysql-davidkhala.d.aivencloud.com:22013/defaultdb?ssl-mode=REQUIRED`)

The warning prompts like

Ignoring invalid configuration option passed to Connection: ssl-mode. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection

This validation is not agreed by Aiven Cloud. The above connection string format is copied directly from Aiven Cloud's Service URI section image

sidorares commented 3 weeks ago

Try this instead:

mysql.createConnection(`mysql://avnadmin:${password}@mysql-davidkhala.d.aivencloud.com:22013/defaultdb?ssl={"rejectUnauthorized":true}`);