{"record":{"id":"885e22a1250c1803","repo":"cube-js/cube","slug":"url-is-required-property","errorCode":null,"errorMessage":"url is required property","messagePattern":"url is required property","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-jdbc-driver/src/JDBCDriver.ts","lineNumber":137,"sourceCode":"\n    this.config = {\n      dbType: getEnv('dbType', { dataSource, preAggregations }),\n      url:\n        getEnv('jdbcUrl', { dataSource, preAggregations }) ||\n        dbTypeDescription && dbTypeDescription.jdbcUrl(),\n      drivername:\n        getEnv('jdbcDriver', { dataSource, preAggregations }) ||\n        dbTypeDescription && dbTypeDescription.driverClass,\n      properties: dbTypeDescription && dbTypeDescription.properties,\n      ...dbOptions\n    } as JDBCDriverConfiguration;\n\n    if (!this.config.drivername) {\n      throw new Error('drivername is required property');\n    }\n\n    if (!this.config.url) {\n      throw new Error('url is required property');\n    }\n\n    const poolName = createPoolName('jdbc', dataSource, preAggregations);\n    this.pool = new Pool(poolName, {\n      create: async () => {\n        await initMvn(await this.getCustomClassPath());\n\n        if (!this.jdbcProps) {\n          /** @protected */\n          this.jdbcProps = this.getJdbcProperties();\n        }\n\n        const getConnection = promisify(DriverManager.getConnection.bind(DriverManager));\n        return new Connection(await getConnection(this.config.url, this.jdbcProps));\n      },\n      destroy: async (connection) => promisify(connection.close.bind(connection))(),\n      validate: async (connection) => (\n        new Promise((resolve) => {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-jdbc-driver/src/JDBCDriver.ts#L119-L155","documentation":"JDBCDriver's constructor requires a JDBC connection URL after checking drivername; it throws 'url is required property' when config.url is empty. The url normally comes from config.url, the CUBEJS_DB_JDBC_URL env var, or a dbType mapping (dbTypeDescription.jdbcUrl()).","triggerScenarios":"new JDBCDriver({...}) with no `url` and no CUBEJS_DB_JDBC_URL env, and either no dbType or a dbType mapping that does not produce a jdbcUrl (e.g. missing other required fields); or url explicitly set to empty string.","commonSituations":"Forgetting CUBEJS_DB_JDBC_URL in cube.js env config; passing `jdbcUrl` instead of `url` in the driver config; dbType given but its URL template requires parts (host/port/db) that are missing; empty-string env var overriding defaults via ...dbOptions spread.","solutions":["Pass `url` explicitly, e.g. url: 'jdbc:postgresql://host:5432/db'","Or set CUBEJS_DB_JDBC_URL in the environment","If relying on dbType, verify the mapping generates a JDBC URL and that required fields (host, database) are provided","Check the config key is `url` (or `jdbcURL` alias) and that the env var isn't empty string"],"exampleFix":"// before\nnew JDBCDriver({ drivername: 'org.postgresql.Driver' });\n// after\nnew JDBCDriver({ drivername: 'org.postgresql.Driver', url: 'jdbc:postgresql://localhost:5432/mydb' });","handlingStrategy":"validation","validationCode":"function assertJdbcUrl(cfg) {\n  if (!cfg.url && !process.env.CUBEJS_DB_JDBC_URL) {\n    throw new Error('JDBCDriver requires `url` (jdbc:...) or CUBEJS_DB_JDBC_URL env');\n  }\n  const url = cfg.url || process.env.CUBEJS_DB_JDBC_URL;\n  if (!/^jdbc:[a-z0-9]+:\\/\\//i.test(url)) {\n    throw new Error(`Suspicious JDBC url: ${url}`);\n  }\n  return cfg;\n}","typeGuard":"function hasJdbcUrl(cfg) {\n  return typeof cfg === 'object' && cfg !== null &&\n    typeof cfg.url === 'string' && cfg.url.startsWith('jdbc:');\n}","tryCatchPattern":"try {\n  driver = new JDBCDriver(options);\n} catch (e) {\n  if (e.message === 'url is required property') {\n    throw new Error('JDBC config is missing `url`; set url or CUBEJS_DB_JDBC_URL (note the key is `url`, not `jdbcUrl`)');\n  }\n  throw e;\n}","preventionTips":["Always provide `url` with a full jdbc: scheme in the driver config","Set CUBEJS_DB_JDBC_URL for env-based deployments and confirm it is non-empty","When relying on dbType URL templates, supply all required fields (host, port, database)","Don't confuse `url` with `jdbcUrl` when writing the config object"],"tags":["configuration","jdbc","validation"],"backgroundTag":"missing-required-config-property","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}