{"record":{"id":"0893552e5e0cd73f","repo":"cube-js/cube","slug":"please-specify-cubejs-db-url","errorCode":null,"errorMessage":"Please specify CUBEJS_DB_URL","messagePattern":"Please specify CUBEJS_DB_URL","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-druid-driver/src/DruidDriver.ts","lineNumber":90,"sourceCode":"    });\n\n    const dataSource =\n      config.dataSource ||\n      assertDataSource('default');\n    const preAggregations = config.preAggregations || false;\n\n    let url = config.url || getEnv('dbUrl', { dataSource, preAggregations });\n\n    if (!url) {\n      const host = getEnv('dbHost', { dataSource, preAggregations });\n      const port = getEnv('dbPort', { dataSource, preAggregations });\n      if (host && port) {\n        const protocol = getEnv('dbSsl', { dataSource, preAggregations })\n          ? 'https'\n          : 'http';\n        url = `${protocol}://${host}:${port}`;\n      } else {\n        throw new Error('Please specify CUBEJS_DB_URL');\n      }\n    }\n    this.config = {\n      url,\n      user:\n        config.user ||\n        getEnv('dbUser', { dataSource, preAggregations }),\n      password:\n        config.password ||\n        getEnv('dbPass', { dataSource, preAggregations }),\n      database:\n        config.database ||\n        getEnv('dbName', { dataSource, preAggregations }) ||\n        'default',\n      ...config,\n    };\n    this.client = new DruidClient(this.config);\n  }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-druid-driver/src/DruidDriver.ts#L72-L108","documentation":"DruidDriver's constructor resolves the Druid SQL endpoint URL from config. If neither a url/CUBEJS_DB_URL nor a usable host+port pair (CUBEJS_DB_HOST and CUBEJS_DB_PORT) is provided, it throws 'Please specify CUBEJS_DB_URL' at driver instantiation time.","triggerScenarios":"Creating a DruidDriver (or starting Cube with dbType: 'druid') without `url` in config and without both `host` and `port` set — e.g. CUBEJS_DB_URL unset and CUBEJS_DB_HOST missing or CUBEJS_DB_PORT missing.","commonSituations":"Incomplete .env during initial setup; only CUBEJS_DB_HOST provided without a port; typo'd env var name so the config field is undefined; Kubernetes secret missing the URL key.","solutions":["Set CUBEJS_DB_URL, e.g. CUBEJS_DB_URL=http://druid-broker:8082.","Or set both CUBEJS_DB_HOST and CUBEJS_DB_PORT so the driver can build the URL.","Pass `url` explicitly in the driver options object when constructing the driver programmatically."],"exampleFix":"// before (.env)\nCUBEJS_DB_TYPE=druid\nCUBEJS_DB_HOST=druid-broker\n// after\nCUBEJS_DB_TYPE=druid\nCUBEJS_DB_URL=http://druid-broker:8082\n# or: CUBEJS_DB_HOST=druid-broker + CUBEJS_DB_PORT=8082","handlingStrategy":"validation","validationCode":"if (!process.env.CUBEJS_DB_URL && !(process.env.CUBEJS_DB_HOST && process.env.CUBEJS_DB_PORT)) {\n  throw new Error('Provide CUBEJS_DB_URL or CUBEJS_DB_HOST+CUBEJS_DB_PORT for Druid');\n}","typeGuard":"function hasDruidEndpoint(cfg) {\n  return Boolean(cfg?.url || (cfg?.host && cfg?.port));\n}","tryCatchPattern":"try {\n  const driver = new DruidDriver(config);\n} catch (e) {\n  if (e.message === 'Please specify CUBEJS_DB_URL') {\n    console.error('Druid endpoint missing: set CUBEJS_DB_URL');\n  } else throw e;\n}","preventionTips":["Validate required env vars at app startup","Set CUBEJS_DB_URL including protocol and broker port (usually 8082)","Keep secrets/urls defined in deployment manifests, not ad hoc shells"],"tags":["configuration","environment","druid","driver"],"backgroundTag":"missing-env-var","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}