cube-js/cube · error

Unsupported configuration exportBucket, some configuration k

Error message

Unsupported configuration exportBucket, some configuration keys are empty: ${emptyRequiredKeys.join(',')}

What it means

When an exportBucket is configured with a supported bucketType, certain required credentials (bucket name, AWS key, AWS secret) must all be set. This error lists the keys that are undefined, thrown from getExportBucket() during driver construction.

Source

Thrown at packages/cubejs-clickhouse-driver/src/ClickHouseDriver.ts:551

    const exportBucket: ClickhouseDriverExportAWS = {
      ...requiredExportBucket,
      keyId: getEnv('dbExportBucketAwsKey', { dataSource, preAggregations }),
      secretKey: getEnv('dbExportBucketAwsSecret', { dataSource, preAggregations }),
    };

    if (exportBucket.bucketType) {
      if (!SUPPORTED_BUCKET_TYPES.includes(exportBucket.bucketType)) {
        throw new Error(
          `Unsupported EXPORT_BUCKET_TYPE, supported: ${SUPPORTED_BUCKET_TYPES.join(',')}`
        );
      }

      // Make sure the required keys are set
      const emptyRequiredKeys = Object.keys(requiredExportBucket)
        .filter((key: string) => requiredExportBucket[<keyof ClickhouseDriverExportRequiredAWS>key] === undefined);
      if (emptyRequiredKeys.length) {
        throw new Error(
          `Unsupported configuration exportBucket, some configuration keys are empty: ${emptyRequiredKeys.join(',')}`
        );
      }

      return exportBucket;
    }

    return null;
  }

  public async isUnloadSupported() {
    return !!this.config.exportBucket;
  }

  /**
   * Returns an array of queried fields meta info.
   */
  public async queryColumnTypes(sql: string, params: unknown[]): Promise<TableStructure> {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Set the env vars named in the error message: EXPORT_BUCKET_TYPE, EXPORT_BUCKET_NAME, EXPORT_BUCKET_AWS_KEY, EXPORT_BUCKET_AWS_SECRET (or dataSource-scoped variants)
  2. Verify the secrets actually reach the Cube process (print sanitized env or check deployment secret mounts)
  3. Ensure IAM credentials for the key/secret have write permission to the bucket
  4. Remove the exportBucket block entirely if unload is not intended, so this validation is skipped

Example fix

// before
EXPORT_BUCKET_TYPE=s3
EXPORT_BUCKET_NAME=my-bucket
# missing key/secret -> error
// after
EXPORT_BUCKET_TYPE=s3
EXPORT_BUCKET_NAME=my-bucket
EXPORT_BUCKET_AWS_KEY=AKIA...
EXPORT_BUCKET_AWS_SECRET=...
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.EXPORT_BUCKET_TYPE) {
  const required = ['EXPORT_BUCKET_NAME','EXPORT_BUCKET_AWS_KEY','EXPORT_BUCKET_AWS_SECRET'];
  const missing = required.filter(k => !process.env[k]);
  if (missing.length) throw new Error(`Export bucket envs missing: ${missing.join(',')}`);
}

Type guard

const hasExportBucketConfig = (env: NodeJS.ProcessEnv): boolean =>
  Boolean(env.EXPORT_BUCKET_TYPE && env.EXPORT_BUCKET_NAME && env.EXPORT_BUCKET_AWS_KEY && env.EXPORT_BUCKET_AWS_SECRET);

Try / catch

try { const driver = new ClickHouseDriver(config); }
catch (e) {
  if (String(e.message).includes('some configuration keys are empty')) throw new Error('Provide all export bucket credentials listed in the error', { cause: e });
  throw e;
}

Prevention

When it happens

Trigger: exportBucket.bucketType is set and supported, but one or more of dbExportBucketAwsKey / dbExportBucketAwsSecret / bucketName envs (for the given dataSource/preAggregations) are missing, so emptyRequiredKeys is non-empty.

Common situations: Credentials not propagated to the environment where Cube runs (Docker/K8s secrets missing); env names spelled incorrectly; using dataSource-scoped env vars (e.g. EXPORT_BUCKET_AWS_KEY_XXX) where only the base name is set, or vice versa; partial config after migrating from another driver.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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