{"id":43339,"library":"mysql-rds-ca","title":"MySQL RDS CA Certificate 2019","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install mysql-rds-ca","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-rds-ca","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-rds-ca","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS-only. Using ESM import will fail.","wrong":"import ca from 'mysql-rds-ca'","symbol":"default","correct":"const ca = require('mysql-rds-ca')"},{"note":"The package exports the certificate string directly, not as a named export.","wrong":"const { ca } = require('mysql-rds-ca')","symbol":"ca","correct":"const ca = require('mysql-rds-ca')"},{"note":"For ESM projects, use namespace import. Default import will not work.","wrong":"import ca from 'mysql-rds-ca'","symbol":"default","correct":"import * as ca from 'mysql-rds-ca'"}],"quickstart":{"code":"const mysql = require('mysql');\nconst ca = require('mysql-rds-ca');\n\nconst connection = mysql.createConnection({\n  host: process.env.RDS_HOST ?? '',\n  user: process.env.RDS_USER ?? '',\n  password: process.env.RDS_PASSWORD ?? '',\n  database: process.env.RDS_DATABASE ?? '',\n  ssl: {\n    ca: ca\n  }\n});\n\nconnection.connect((err) => {\n  if (err) {\n    console.error('Connection failed:', err);\n    return;\n  }\n  console.log('Connected to RDS with SSL');\n  connection.end();\n});","lang":"javascript","description":"Demonstrates connecting to Amazon RDS MySQL using the 2019 CA certificate for SSL."},"warnings":[{"fix":"Check your RDS instance's CA certificate setting in AWS Console.","message":"The certificate is the rds-ca-2019-root.pem file. Ensure your RDS instance uses the 2019 CA certificate.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use mysql2 or mysql2/promise instead of mysql.","message":"The mysql package is in maintenance mode; prefer mysql2 for better SSL support and active development.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use require() or dynamic import() with default export.","message":"The package is CommonJS only. ESM import will cause a runtime error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Pass only the ca property; do not mix with other ssl options unless you have corresponding key and cert.","message":"The exported value is a string (the PEM certificate). It cannot be used directly with other SSL options like key or cert.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':21 '2019':5,10 'amazon':8 'ca':3,11,39 'certif':4,12,40,51 'contain':46 'current':24 'custom':38 'encod':50 'file':45 'javascript':64 'modul':19,35 'mysql':1,17,34 'mysql2':59 'nativ':63 'new':55 'npm':18 'offici':36 'packag':28 'pem':49 'pem-encod':48 'prefer':57 'project':56 'provid':6 'rds':2,9 'recommend':53 'releas':26 'singl':44 'ssl':62 'stabl':25 'stopgap':31 'support':37,61 'use':14,58 'version':20","created_at":"2026-06-05T16:59:19.331190+00:00","updated_at":"2026-06-05T16:59:19.331190+00:00","problems":[{"fix":"Ensure the certificate is loaded correctly using require('mysql-rds-ca') and passed to ssl.ca.","cause":"The CA certificate is not trusted or not provided correctly.","error":"Error: self signed certificate in certificate chain"},{"fix":"Update your RDS instance to use the 2019 CA certificate, or use the appropriate CA file.","cause":"The RDS instance uses a different CA certificate (e.g., rds-ca-2015).","error":"Error: unable to verify the first certificate"},{"fix":"Use require('mysql-rds-ca') in CommonJS or use dynamic import() in ESM: const ca = (await import('mysql-rds-ca')).default;","cause":"The require statement returned undefined, possibly due to ESM import.","error":"TypeError: Cannot read properties of undefined (reading 'ca')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mysql-rds-ca","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}