{"id":"1e9815e0af86db81","repo":"sidorares/node-mysql2","slug":"unknown-ssl-profile-name","errorCode":null,"errorMessage":"Unknown SSL profile '${name}'","messagePattern":"Unknown SSL profile '(.+?)'","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/connection_config.js","lineNumber":270,"sourceCode":"\n    return defaultFlags;\n  }\n\n  static getCharsetNumber(charset) {\n    const num = Charsets[charset.toUpperCase()];\n    if (num === undefined) {\n      throw new TypeError(`Unknown charset '${charset}'`);\n    }\n    return num;\n  }\n\n  static getSSLProfile(name) {\n    if (!SSLProfiles) {\n      SSLProfiles = require('./constants/ssl_profiles.js');\n    }\n    const ssl = SSLProfiles[name];\n    if (ssl === undefined) {\n      throw new TypeError(`Unknown SSL profile '${name}'`);\n    }\n    return ssl;\n  }\n\n  static parseUrl(url) {\n    const parsedUrl = new URL(url);\n    const options = {\n      host: decodeURIComponent(parsedUrl.hostname),\n      port: parseInt(parsedUrl.port, 10),\n      database: decodeURIComponent(parsedUrl.pathname.slice(1)),\n      user: decodeURIComponent(parsedUrl.username),\n      password: decodeURIComponent(parsedUrl.password),\n    };\n    for (const [key, value] of parsedUrl.searchParams) {\n      if (key in options) {\n        continue;\n      }\n      try {","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/sidorares/node-mysql2/blob/5ebe8903d6aea2d8ea1490e11b52491526e50f19/lib/connection_config.js#L252-L288","documentation":"ConnectionConfig.getSSLProfile() looks up the provided profile name in the built-in SSL profiles map (lib/constants/ssl_profiles.js). If the name is not a key in that map, mysql2 does not know the profile and throws. The string form of `ssl` is only for the small set of named profiles bundled with the library (commonly none or a few well-known CA bundles); custom TLS settings must be passed as an object.","triggerScenarios":"Passing `ssl: 'AmazonRDS'` or another string that is not present in the bundled ssl_profiles map. Most mysql2 installs ship an empty or minimal profile set, so almost any string other than a documented key will throw.","commonSituations":"Following an outdated tutorial referencing a named profile that was removed or never bundled; assuming `ssl: 'rds'` works; using a profile name from a different driver.","solutions":["Pass the TLS options as an object directly: `ssl: { ca: fs.readFileSync('rds-ca.pem') }`.","If you intended a named profile, verify it exists in lib/constants/ssl_profiles.js for your mysql2 version.","Omit `ssl` or set it to `false` if you do not need TLS."],"exampleFix":"// before\nmysql.createConnection({ host, user, password, ssl: 'AmazonRDS' });\n\n// after\nconst fs = require('fs');\nmysql.createConnection({\n  host,\n  user,\n  password,\n  ssl: { ca: fs.readFileSync('rds-ca-cert.pem') },\n});","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction buildSsl(profileOrObject) {\n  if (typeof profileOrObject === 'string') {\n    // only use a string if you know it exists in lib/constants/ssl_profiles.js\n    return profileOrObject;\n  }\n  if (profileOrObject && typeof profileOrObject === 'object') {\n    return profileOrObject; // e.g. { ca: fs.readFileSync('cert.pem') }\n  }\n  throw new TypeError('ssl must be a known profile string or a TLS options object');\n}","typeGuard":"function isSslObject(ssl) {\n  return typeof ssl === 'string' || (typeof ssl === 'object' && ssl !== null && !Array.isArray(ssl));\n}","tryCatchPattern":null,"preventionTips":["Prefer passing a TLS options object with your CA bundle rather than a profile name.","Do not assume a named profile is bundled — check ssl_profiles.js for your version.","Load certificates from files into the object form for portability."],"tags":["ssl","connection-config","tls"],"analyzedSha":"5ebe8903d6aea2d8ea1490e11b52491526e50f19","analyzedAt":"2026-08-03T18:58:53.602Z","schemaVersion":2}