cube-js/cube · warning

The ${keyByDataSource('CUBEJS_DB_SCHEMA', dataSource)} is de

Error message

The ${keyByDataSource('CUBEJS_DB_SCHEMA', dataSource)} is deprecated. Please, use the ${keyByDataSource('CUBEJS_DB_NAME', dataSource)} instead.

What it means

Cube renamed the per-datasource database schema env var CUBEJS_DB_SCHEMA (with datasource suffix variants) to CUBEJS_DB_NAME. When the deprecated var is read, Cube warns and directs users to the replacement while still returning the old value.

Source

Thrown at packages/cubejs-backend-shared/src/env.ts:600

      );
    }
    return val;
  },

  /**
   * Database name.
   * @deprecated
   */
  dbSchema: ({
    required,
    dataSource,
    preAggregations,
  }: {
    dataSource: string,
    required?: boolean,
    preAggregations?: boolean,
  }) => {
    console.warn(
      `The ${
        keyByDataSource('CUBEJS_DB_SCHEMA', dataSource)
      } is deprecated. Please, use the ${
        keyByDataSource('CUBEJS_DB_NAME', dataSource)
      } instead.`
    );
    const val = get(keyByDataSource('CUBEJS_DB_SCHEMA', dataSource, preAggregations)).asString();
    if (required && !val) {
      throw new Error(
        `The ${
          keyByDataSource('CUBEJS_DB_SCHEMA', dataSource)
        } is required and missing.`
      );
    }
    return val;
  },

  /**

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Rename CUBEJS_DB_SCHEMA to CUBEJS_DB_NAME (and suffixed variants to CUBEJS_DB_NAME_<DATA_SOURCE>) in your environment
  2. Confirm the target driver honors CUBEJS_DB_NAME
  3. Restart Cube after updating env and verify the warning disappears

Example fix

// before
CUBEJS_DB_SCHEMA=analytics
// after
CUBEJS_DB_NAME=analytics
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.CUBEJS_DB_SCHEMA) console.warn('Use CUBEJS_DB_NAME instead of deprecated CUBEJS_DB_SCHEMA');

Prevention

When it happens

Trigger: A driver/datasource calls env function dbSchema (e.g. from driverConfigToDbDetails or schema requirements) and CUBEJS_DB_SCHEMA or CUBEJS_DB_SCHEMA_<DATA_SOURCE> is present in the environment.

Common situations: Old docker-compose/env templates; upgrading Cube where driver configs still reference CUBEJS_DB_SCHEMA; multi-datasource setups with suffixed legacy vars.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/de77a67a6c9ef5dc. Report an issue: GitHub.