{"record":{"id":"66251c5c5417a9e7","repo":"cube-js/cube","slug":"content-of-the-file-from-envkey-is-not-a-valid","errorCode":null,"errorMessage":"Content of the file from ${envKey} is not a valid SSL ${name}.","messagePattern":"Content of the file from (.+?) is not a valid SSL (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-base-driver/src/BaseDriver.ts","lineNumber":267,"sourceCode":"              };\n            }\n\n            if (canBeFile && isFilePath(value)) {\n              if (!fs.existsSync(value)) {\n                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    }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-base-driver/src/BaseDriver.ts#L249-L285","documentation":"When an SSL option points to an existing file (via env var), getSslOptions() reads it and validates the content (e.g. checks it is a PEM cert/key). If the file content fails validation, this error is thrown.","triggerScenarios":"The env var (e.g. CUBEJS_DB_SSL_CERT) points to an existing file whose contents do not pass the SSL validator (not valid PEM, wrong format, empty, HTML error page).","commonSituations":"Downloading a cert and saving an error page, copying the wrong file (e.g. the CSR instead of the cert), truncated base64, Windows line-ending corruption, or pointing at a bundle in the wrong format.","solutions":["Inspect the file content and confirm it is valid PEM for the expected type (CERTIFICATE / PRIVATE KEY)","Re-export or re-download the certificate in PEM format","Check you pointed the env var at the correct file (cert vs key vs CA)","Use an inline value instead of a file path to bypass file reading"],"exampleFix":"// before\nCUBEJS_DB_SSL_CA=/downloads/ca.crt   // file is actually JSON error output\n// after\nCUBEJS_DB_SSL_CA=/etc/ssl/rootCA.pem // valid PEM content","handlingStrategy":"validation","validationCode":"const content = fs.readFileSync(envVal, 'utf8');\nif (!content.includes('-----BEGIN') || !content.includes('-----END')) throw new Error(`Invalid PEM in ${envKey}`);","typeGuard":null,"tryCatchPattern":"try { await cubeServer(); } catch (e) { if (/not a valid SSL/.test(e.message)) console.error('Fix the SSL file content referenced by env var'); throw e; }","preventionTips":["Validate PEM files (openssl x509 -in f.pem -noout) before wiring them in","Keep cert/key/CA files in a dedicated, versioned location","Never pipe command output directly into cert files without checking it","Distinguish cert, key, and CA files by naming convention"],"tags":["ssl","configuration","validation"],"backgroundTag":"ssl-certificate-invalid","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}