{"record":{"id":"f09bcb3ef5e3e6e1","repo":"cube-js/cube","slug":"envkey-is-not-a-valid-ssl-name-if-it-s-a-pa","errorCode":null,"errorMessage":"${envKey} is not a valid SSL ${name}. If it's a path, please specify it correctly","messagePattern":"(.+?) is not a valid SSL (.+?)\\. If it's a path, please specify it correctly","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-base-driver/src/BaseDriver.ts","lineNumber":272,"sourceCode":"                throw new Error(\n                  `Unable to find ${name} from path: \"${value}\"`,\n                );\n              }\n\n              const file = fs.readFileSync(value, 'utf8');\n              if (validate(file)) {\n                return {\n                  ...agg,\n                  ...{ [name]: file }\n                };\n              }\n\n              throw new Error(\n                `Content of the file from ${envKey} is not a valid SSL ${name}.`,\n              );\n            }\n\n            throw new Error(\n              `${envKey} is not a valid SSL ${name}. If it's a path, please specify it correctly`,\n            );\n          }\n\n          return agg;\n        },\n        {}\n      );\n\n      ssl.rejectUnauthorized = getEnv('dbSslRejectUnauthorized', { dataSource, preAggregations });\n\n      return ssl;\n    }\n\n    return undefined;\n  }\n\n  public abstract testConnection(): Promise<void>;","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-base-driver/src/BaseDriver.ts#L254-L290","documentation":"Validation in BaseDriver.getSslOptions: an SSL credential environment variable (e.g. CUBEJS_DB_SSL_CA/CERT/KEY, per its `envKey`) contains a value that is neither a valid PEM certificate body nor a path to a readable file containing one. Fires while building driver SSL options from environment configuration.","triggerScenarios":"An SSL option (e.g. CUBEJS_DB_SSL_KEY) is set to arbitrary text that is neither PEM nor an existing file path, or a path with typos/unsupported characters.","commonSituations":"Setting env vars to placeholder values like 'true', mistyped paths, or passing a URL instead of a local file path.","solutions":["Set the env variable to a valid file path pointing to the PEM file, or inline the full PEM content.","Verify the file exists and is readable by the Cube process (see the companion 'Unable to find ... from path' / 'not a valid SSL' errors).","Check for truncated or wrongly concatenated certificate content in the environment value."],"exampleFix":"// before\nCUBEJS_DB_SSL_CERT=true\n// after\nCUBEJS_DB_SSL_CERT=/etc/ssl/certs/client.pem","handlingStrategy":"validation","validationCode":"function assertSslOpt(v?: string) {\n  if (!v) return;\n  const looksLikePath = v.startsWith('/') || v.startsWith('./');\n  if (looksLikePath && !fs.existsSync(v)) throw new Error(`SSL path invalid: ${v}`);\n  if (!looksLikePath && !v.includes('-----BEGIN')) throw new Error('SSL value is neither PEM nor path');\n}","typeGuard":null,"tryCatchPattern":"try { await driver.testConnection(); } catch (e) { if (/is not a valid SSL/.test(e.message)) console.error('Set the SSL env var to PEM content or an existing file path'); throw e; }","preventionTips":["Use absolute file paths in SSL env vars","Keep values in env files free of stray quotes and whitespace","Validate SSL config in CI before deploy","Unset unused SSL variables to avoid placeholder leakage"],"tags":["ssl","configuration","env-var"],"backgroundTag":"ssl-certificate-invalid","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}