Skip to content

Commit de071bb

Browse files
authored
fix: handshake SSL error with AWS RDS (#2857)
* fix: handshake SSL error with AWS RDS * chore: deprecate `Amazon RDS` ssl option * docs: use `aws-ssl-profiles` * ci: adjust coverage rate
1 parent cd0b059 commit de071bb

File tree

8 files changed

+74
-2891
lines changed

8 files changed

+74
-2891
lines changed

.nycrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"include": ["index.js", "promise.js", "lib/**/*.js"],
44
"exclude": ["mysqldata/**", "node_modules/**", "test/**"],
55
"reporter": ["text", "lcov", "cobertura"],
6-
"statements": 88,
6+
"statements": 86,
77
"branches": 84,
88
"functions": 77,
9-
"lines": 88,
9+
"lines": 86,
1010
"checkCoverage": true,
1111
"clean": true
1212
}

codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ coverage:
22
status:
33
project:
44
default:
5-
target: 89%
5+
target: 88%
66
threshold: 2%
77
patch:
88
default:

lib/constants/ssl_profiles.js

+7-2,882
Large diffs are not rendered by default.

package-lock.json

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"author": "Andrey Sidorov <[email protected]>",
5959
"license": "MIT",
6060
"dependencies": {
61+
"aws-ssl-profiles": "^1.1.1",
6162
"denque": "^2.1.0",
6263
"generate-function": "^2.3.1",
6364
"iconv-lite": "^0.6.3",

website/docs/examples/connections/create-connection.mdx

+16-2
Original file line numberDiff line numberDiff line change
@@ -218,25 +218,34 @@ You can use **Amazon RDS** string as value to ssl property to connect to **Amazo
218218

219219
In that case https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem CA cert is used:
220220

221+
```sh
222+
npm install --save aws-ssl-profiles
223+
```
224+
221225
<Tabs>
222226
<TabItem value='promise.js' default>
223227

224228
```js
225229
import mysql from 'mysql2/promise';
230+
import awsCaBundle from 'aws-ssl-profiles';
226231

227232
try {
228233
// highlight-start
229234
const connection = await mysql.createConnection({
230235
// ...
231236
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
232-
ssl: 'Amazon RDS',
237+
ssl: awsCaBundle,
233238
});
234239
// highlight-end
235240
} catch (err) {
236241
console.log(err);
237242
}
238243
```
239244

245+
:::info
246+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
247+
:::
248+
240249
:::tip Testing
241250

242251
```js
@@ -257,18 +266,23 @@ try {
257266

258267
```js
259268
const mysql = require('mysql2');
269+
const awsCaBundle = require('aws-ssl-profiles');
260270

261271
const connection = mysql.createConnection({
262272
// ...
263273
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
264-
ssl: 'Amazon RDS',
274+
ssl: awsCaBundle,
265275
});
266276

267277
connection.addListener('error', (err) => {
268278
console.log(err);
269279
});
270280
```
271281

282+
:::info
283+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
284+
:::
285+
272286
:::tip Testing
273287

274288
```js

website/docs/examples/connections/create-pool.mdx

+16-2
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,23 @@ You can use **Amazon RDS** string as value to ssl property to connect to **Amazo
298298

299299
In that case https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem CA cert is used:
300300

301+
```sh
302+
npm install --save aws-ssl-profiles
303+
```
304+
301305
<Tabs>
302306
<TabItem value='promise.js' default>
303307

304308
```js
305309
import mysql from 'mysql2/promise';
310+
import awsCaBundle from 'aws-ssl-profiles';
306311

307312
try {
308313
// highlight-start
309314
const pool = mysql.createPool({
310315
// ...
311316
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
312-
ssl: 'Amazon RDS',
317+
ssl: awsCaBundle,
313318
});
314319
const connection = await pool.getConnection();
315320
// highlight-end
@@ -322,6 +327,10 @@ try {
322327
}
323328
```
324329

330+
:::info
331+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
332+
:::
333+
325334
:::tip Testing
326335

327336
```js
@@ -342,11 +351,12 @@ try {
342351

343352
```js
344353
const mysql = require('mysql2');
354+
const awsCaBundle = require('aws-ssl-profiles');
345355

346356
const pool = mysql.createPool({
347357
// ...
348358
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
349-
ssl: 'Amazon RDS',
359+
ssl: awsCaBundle,
350360
});
351361

352362
pool.getConnection(function (err, connection) {
@@ -361,6 +371,10 @@ pool.getConnection(function (err, connection) {
361371
});
362372
```
363373

374+
:::info
375+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
376+
:::
377+
364378
:::tip Testing
365379

366380
```js

website/docs/examples/connections/createPoolCluster.mdx

+16-2
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,16 @@ You can use **Amazon RDS** string as value to ssl property to connect to **Amazo
322322

323323
In that case https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem CA cert is used:
324324

325+
```sh
326+
npm install --save aws-ssl-profiles
327+
```
328+
325329
<Tabs>
326330
<TabItem value='promise.js' default>
327331

328332
```js
329333
import mysql from 'mysql2/promise';
334+
import awsCaBundle from 'aws-ssl-profiles';
330335

331336
try {
332337
// highlight-start
@@ -335,7 +340,7 @@ try {
335340
poolCluster.add('clusterA', {
336341
// ...
337342
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
338-
ssl: 'Amazon RDS',
343+
ssl: awsCaBundle,
339344
});
340345
// poolCluster.add('clusterB', '...');
341346

@@ -350,6 +355,10 @@ try {
350355
}
351356
```
352357

358+
:::info
359+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
360+
:::
361+
353362
:::tip Testing
354363

355364
```js
@@ -370,13 +379,14 @@ try {
370379

371380
```js
372381
const mysql = require('mysql2');
382+
const awsCaBundle = require('aws-ssl-profiles');
373383

374384
const poolCluster = mysql.createPoolCluster();
375385

376386
poolCluster.add('clusterA', {
377387
// ...
378388
host: 'db.id.ap-southeast-2.rds.amazonaws.com',
379-
ssl: 'Amazon RDS',
389+
ssl: awsCaBundle,
380390
});
381391
// poolCluster.add('clusterB', '...');
382392

@@ -392,6 +402,10 @@ poolCluster.getConnection('clusterA', function (err, connection) {
392402
});
393403
```
394404

405+
:::info
406+
For detailed instructions, please follow the [**AWS SSL Profiles documentation**](https://github.com/mysqljs/aws-ssl-profiles?tab=readme-ov-file#readme).
407+
:::
408+
395409
:::tip Testing
396410

397411
```js

0 commit comments

Comments
 (0)