{"record":{"id":"738b4d66417f399b","repo":"cube-js/cube","slug":"the-keybydatasource-cubejs-db-ssl-datasource","errorCode":null,"errorMessage":"The ${keyByDataSource('CUBEJS_DB_SSL', dataSource)} must be either 'true' or 'false'.","messagePattern":"The (.+?) must be either 'true' or 'false'\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-shared/src/env.ts","lineNumber":411,"sourceCode":"  dbType: ({ dataSource }: DataSourceOpts) => (\n    // We don't support different driverType for pre-aggregations right now\n    get(keyByDataSource('CUBEJS_DB_TYPE', dataSource, false)).asString()\n  ),\n\n  /**\n   * Use SSL connection flag.\n   */\n  dbSsl: ({\n    dataSource,\n    preAggregations,\n  }: DataSourceOpts) => {\n    const val = get(keyByDataSource('CUBEJS_DB_SSL', dataSource, preAggregations)).default('false').asString();\n    if (val.toLocaleLowerCase() === 'true') {\n      return true;\n    } else if (val.toLowerCase() === 'false') {\n      return false;\n    } else {\n      throw new TypeError(\n        `The ${\n          keyByDataSource('CUBEJS_DB_SSL', dataSource)\n        } must be either 'true' or 'false'.`\n      );\n    }\n  },\n\n  /**\n   * Reject unauthorized SSL connection flag.\n   */\n  dbSslRejectUnauthorized: ({\n    dataSource,\n    preAggregations,\n  }: DataSourceOpts) => {\n    const val = get(keyByDataSource('CUBEJS_DB_SSL_REJECT_UNAUTHORIZED', dataSource, preAggregations)).default('false').asString();\n    if (val.toLocaleLowerCase() === 'true') {\n      return true;\n    } else if (val.toLowerCase() === 'false') {","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/env.ts#L393-L429","documentation":"Cube reads CUBEJS_DB_SSL (per data source via keyByDataSource) and only accepts the literal strings 'true' or 'false' (case-insensitive); anything else throws a TypeError. The message interpolates the actual data-source-specific variable name, e.g. CUBEJS_DS_MYSQL_DB_SSL.","triggerScenarios":"Setting CUBEJS_DB_SSL (or CUBEJS_DS_<DS>_DB_SSL) to values like '1', 'yes', 'on', 'enabled', or leaving stray quotes/whitespace such as '\"true\"'.","commonSituations":"Shell quoting adding literal quotes around the value; using 1/0 or yes/no conventions from other tools; CI secrets platforms injecting trailing whitespace or newline characters.","solutions":["Set the variable to exactly true or false (no quotes, no whitespace).","Inspect the deployed value: node -e \"console.log(JSON.stringify(process.env.CUBEJS_DB_SSL))\" to reveal hidden characters.","Trim/normalize the value in your CI secret configuration.","Update scripts that set 1/0 or yes/no to true/false."],"exampleFix":"// before\nCUBEJS_DB_SSL=\"true\"   # literal quotes break parsing\nCUBEJS_DB_SSL=yes\n// after\nCUBEJS_DB_SSL=true","handlingStrategy":"validation","validationCode":"for (const [k, v] of Object.entries(process.env)) {\n  if (k.endsWith('_DB_SSL') && v !== undefined && !/^(true|false)$/i.test(v.trim()))\n    throw new Error(`${k} must be 'true' or 'false', got: ${JSON.stringify(v)}`);\n}","typeGuard":"function isBoolString(v: unknown): v is 'true' | 'false' {\n  return v === 'true' || v === 'false' || v === 'TRUE' || v === 'FALSE';\n}","tryCatchPattern":"try {\n  dbSslEnabled(dataSource);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes(\"either 'true' or 'false'\")) {\n    console.error(`Set ${keyByDataSource('CUBEJS_DB_SSL', dataSource)} to true or false`);\n  }\n  throw e;\n}","preventionTips":["Write booleans as bare true/false in env files, never quoted or 1/0.","Check deployed values with node -p \"JSON.stringify(process.env.X)\" for hidden quotes/whitespace.","Normalize quoting in secret managers and Helm templates."],"tags":["configuration","ssl","environment-variables","typeerror"],"backgroundTag":"invalid-boolean-env-var","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}