cube-js/cube · error · 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, all required AWS keys (bucketType, bucketName, keyId, secretKey, etc. — those collected in requiredExportBucket) must be present. The driver throws listing the empty keys when any are undefined.

Source

Thrown at packages/cubejs-redshift-driver/src/RedshiftDriver.ts:372

    const exportBucket: Partial<RedshiftDriverExportAWS> = {
      ...requiredExportBucket,
      keyId: getEnv('dbExportBucketAwsKey', { dataSource, preAggregations }),
      secretKey: getEnv('dbExportBucketAwsSecret', { dataSource, preAggregations }),
      unloadArn: getEnv('redshiftUnloadArn', { dataSource, preAggregations }),
    };

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

      // Make sure the required keys are set
      const emptyRequiredKeys = Object.keys(requiredExportBucket)
        .filter((key: string) => requiredExportBucket[<keyof RedshiftDriverExportRequiredAWS>key] === undefined);
      if (emptyRequiredKeys.length) {
        throw new Error(
          `Unsupported configuration exportBucket, some configuration keys are empty: ${emptyRequiredKeys.join(',')}`
        );
      }
      // If unload ARN is not set, secret and key id must be set for Redshift
      if (!exportBucket.unloadArn) {
        // Make sure the required keys are set
        const emptySecretKeys = Object.keys(exportBucket)
          .filter((key: string) => key !== 'unloadArn')
          .filter((key: string) => exportBucket[<keyof RedshiftDriverExportAWS>key] === undefined);
        if (emptySecretKeys.length) {
          throw new Error(
            `Unsupported configuration exportBucket, some configuration keys are empty: ${emptySecretKeys.join(',')}`
          );
        }
      }

      return <RedshiftDriverExportAWS>exportBucket;
    }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Set all required env vars: CUBEJS_EXPORT_BUCKET_TYPE, CUBEJS_EXPORT_BUCKET_NAME, CUBEJS_EXPORT_BUCKET_AWS_KEY, CUBEJS_EXPORT_BUCKET_AWS_SECRET
  2. Verify getEnv('dbExportBucketAwsKey'/'dbExportBucketAwsSecret', { dataSource, preAggregations }) overrides actually resolve for the relevant dataSource
  3. Alternatively set exportBucket.unloadArn so only the ARN-based path is used (still requires the other required keys here)

Example fix

// before
CUBEJS_EXPORT_BUCKET_TYPE=s3
CUBEJS_EXPORT_BUCKET_NAME=my-bucket
# AWS key/secret missing
// after
CUBEJS_EXPORT_BUCKET_TYPE=s3
CUBEJS_EXPORT_BUCKET_NAME=my-bucket
CUBEJS_EXPORT_BUCKET_AWS_KEY=AKIA...
CUBEJS_EXPORT_BUCKET_AWS_SECRET=...
Defensive patterns

Strategy: validation

Validate before calling

const required = ['CUBEJS_EXPORT_BUCKET_TYPE', 'CUBEJS_EXPORT_BUCKET_NAME', 'CUBEJS_EXPORT_BUCKET_AWS_KEY', 'CUBEJS_EXPORT_BUCKET_AWS_SECRET'];
const missing = required.filter(k => !process.env[k]);
if (missing.length) throw new Error(`exportBucket missing env vars: ${missing.join(',')}`);

Prevention

When it happens

Trigger: getExportBucket (via getInitialConfiguration) finds requiredExportBucket entries that are undefined — i.e. one of CUBEJS_EXPORT_BUCKET_TYPE / CUBEJS_EXPORT_BUCKET_NAME / CUBEJS_EXPORT_BUCKET_AWS_KEY / CUBEJS_EXPORT_BUCKET_AWS_SECRET is unset while exportBucket config exists.

Common situations: Partially configured env: bucket name set but AWS key/secret missing; per-dataSource or per-preAggregation overrides silently not applied; keys supplied only in one deployment environment.

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/bdc5efebc07b218b. Report an issue: GitHub.