Registry / storage / mysql-rds-ca

mysql-rds-ca

JSON →
library1.0.1jsnpmunverified

Provides the Amazon RDS 2019 CA certificate for use with the mysql npm module. Version 1.0.1 is the current stable release. This package is a stopgap until the mysql module officially supports custom CA certificates. It is a single file containing the PEM-encoded certificate. Not recommended for new projects; prefer using mysql2 which supports SSL natively.

npm install mysql-rds-ca
INSTALL
IMPORT
SIG · MYSQL-RDS-CA
M
mysql-rds-ca
storagejavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const ca = require('mysql-rds-ca')
import ca from 'mysql-rds-ca'
Package is CJS-only. Using ESM import will fail.
ca
const ca = require('mysql-rds-ca')
const { ca } = require('mysql-rds-ca')
The package exports the certificate string directly, not as a named export.
default
import * as ca from 'mysql-rds-ca'
import ca from 'mysql-rds-ca'
For ESM projects, use namespace import. Default import will not work.

Demonstrates connecting to Amazon RDS MySQL using the 2019 CA certificate for SSL.

const mysql = require('mysql'); const ca = require('mysql-rds-ca'); const connection = mysql.createConnection({ host: process.env.RDS_HOST ?? '', user: process.env.RDS_USER ?? '', password: process.env.RDS_PASSWORD ?? '', database: process.env.RDS_DATABASE ?? '', ssl: { ca: ca } }); connection.connect((err) => { if (err) { console.error('Connection failed:', err); return; } console.log('Connected to RDS with SSL'); connection.end(); });
Debug
Known issues
gotchaThe certificate is the rds-ca-2019-root.pem file. Ensure your RDS instance uses the 2019 CA certificate.
fix
Check your RDS instance's CA certificate setting in AWS Console.
affects: >=1.0.0
deprecatedThe mysql package is in maintenance mode; prefer mysql2 for better SSL support and active development.
fix
Use mysql2 or mysql2/promise instead of mysql.
affects: >=1.0.0
breakingThe package is CommonJS only. ESM import will cause a runtime error.
fix
Use require() or dynamic import() with default export.
affects: >=1.0.0
gotchaThe exported value is a string (the PEM certificate). It cannot be used directly with other SSL options like key or cert.
fix
Pass only the ca property; do not mix with other ssl options unless you have corresponding key and cert.
affects: >=1.0.0
Errors
Common errors & fixes
Error: self signed certificate in certificate chain
The CA certificate is not trusted or not provided correctly.
fix
Ensure the certificate is loaded correctly using require('mysql-rds-ca') and passed to ssl.ca.
Error: unable to verify the first certificate
The RDS instance uses a different CA certificate (e.g., rds-ca-2015).
fix
Update your RDS instance to use the 2019 CA certificate, or use the appropriate CA file.
TypeError: Cannot read properties of undefined (reading 'ca')
The require statement returned undefined, possibly due to ESM import.
fix
Use require('mysql-rds-ca') in CommonJS or use dynamic import() in ESM: const ca = (await import('mysql-rds-ca')).default;
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
mysql-rds-ca — npm install mysql-rds-ca · libregistry