cube-js/cube · error · Error
url is required property
Error message
url is required property
What it means
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()).
Source
Thrown at packages/cubejs-jdbc-driver/src/JDBCDriver.ts:137
this.config = {
dbType: getEnv('dbType', { dataSource, preAggregations }),
url:
getEnv('jdbcUrl', { dataSource, preAggregations }) ||
dbTypeDescription && dbTypeDescription.jdbcUrl(),
drivername:
getEnv('jdbcDriver', { dataSource, preAggregations }) ||
dbTypeDescription && dbTypeDescription.driverClass,
properties: dbTypeDescription && dbTypeDescription.properties,
...dbOptions
} as JDBCDriverConfiguration;
if (!this.config.drivername) {
throw new Error('drivername is required property');
}
if (!this.config.url) {
throw new Error('url is required property');
}
const poolName = createPoolName('jdbc', dataSource, preAggregations);
this.pool = new Pool(poolName, {
create: async () => {
await initMvn(await this.getCustomClassPath());
if (!this.jdbcProps) {
/** @protected */
this.jdbcProps = this.getJdbcProperties();
}
const getConnection = promisify(DriverManager.getConnection.bind(DriverManager));
return new Connection(await getConnection(this.config.url, this.jdbcProps));
},
destroy: async (connection) => promisify(connection.close.bind(connection))(),
validate: async (connection) => (
new Promise((resolve) => {View on GitHub (pinned to 7d981676b3)
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
Example fix
// before
new JDBCDriver({ drivername: 'org.postgresql.Driver' });
// after
new JDBCDriver({ drivername: 'org.postgresql.Driver', url: 'jdbc:postgresql://localhost:5432/mydb' }); Defensive patterns
Strategy: validation
Validate before calling
function assertJdbcUrl(cfg) {
if (!cfg.url && !process.env.CUBEJS_DB_JDBC_URL) {
throw new Error('JDBCDriver requires `url` (jdbc:...) or CUBEJS_DB_JDBC_URL env');
}
const url = cfg.url || process.env.CUBEJS_DB_JDBC_URL;
if (!/^jdbc:[a-z0-9]+:\/\//i.test(url)) {
throw new Error(`Suspicious JDBC url: ${url}`);
}
return cfg;
} Type guard
function hasJdbcUrl(cfg) {
return typeof cfg === 'object' && cfg !== null &&
typeof cfg.url === 'string' && cfg.url.startsWith('jdbc:');
} Try / catch
try {
driver = new JDBCDriver(options);
} catch (e) {
if (e.message === 'url is required property') {
throw new Error('JDBC config is missing `url`; set url or CUBEJS_DB_JDBC_URL (note the key is `url`, not `jdbcUrl`)');
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- drivername is required property
- A user-defined contextToApiScopes function returns a wrong s
- Value "${input}" is not valid for ${envName}. ${description}
- Value "${input}" is not valid for ${envName}. Should be a po
- Value "${input}" is not valid for ${envName}. Should be lowe
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/885e22a1250c1803.
Report an issue: GitHub.