cube-js/cube · error

Export bucket is not configured.

Error message

Export bucket is not configured.

What it means

PrestoDriver.unload implements result export to an external storage bucket (unload support is advertised only when config.exportBucket is set). If unload is invoked when exportBucket is not configured, the driver throws 'Export bucket is not configured.' because it has nowhere to write the exported data.

Source

Thrown at packages/cubejs-prestodb-driver/src/PrestoDriver.ts:374

      unloadWithoutTempTable: true
    };
  }

  public async createSchemaIfNotExists(schemaName: string) {
    await this.query(
      `CREATE SCHEMA IF NOT EXISTS ${this.config.catalog}.${schemaName}`,
      [],
    );
  }

  // Export bucket methods
  public async isUnloadSupported() {
    return this.config.exportBucket !== undefined;
  }

  public async unload(tableName: string, options: UnloadOptions) {
    if (!this.config.exportBucket) {
      throw new Error('Export bucket is not configured.');
    }

    if (!SUPPORTED_BUCKET_TYPES.includes(this.config.bucketType as string)) {
      throw new Error(`Unsupported export bucket type: ${this.config.bucketType}`);
    }

    const types = options.query
      ? await this.unloadWithSql(tableName, options.query.sql, options.query.params)
      : await this.unloadWithTable(tableName);

    const csvFile = await this.getCsvFiles(tableName);

    return {
      exportBucketCsvEscapeSymbol: this.config.exportBucketCsvEscapeSymbol,
      csvFile,
      types,
      csvNoHeader: true,
    };

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Configure exportBucket (type, bucket, region/credentials) in the PrestoDriver config
  2. Provide the corresponding export bucket env variables in the deployment
  3. Avoid the unload path (e.g. disable unload-based flows) if external export is not needed

Example fix

// before
const driver = new PrestoDriver({ url: '...', catalog: 'hive', schema: 'default' });
// after
const driver = new PrestoDriver({
  url: '...', catalog: 'hive', schema: 'default',
  exportBucket: { bucketType: 's3', bucket: 'my-export-bucket', region: 'us-east-1' }
});
Defensive patterns

Strategy: validation

Validate before calling

if (!driver.config?.exportBucket) {
  throw new Error('Configure exportBucket before triggering unload');
}
await driver.unload(tableName, options);

Type guard

const canUnload = (driver) => driver.config?.exportBucket !== undefined;

Try / catch

try {
  await driver.unload(tableName, options);
} catch (e) {
  if (String(e.message).includes('Export bucket is not configured')) {
    console.error('Set exportBucket in PrestoDriver config or the export env vars');
  }
  throw e;
}

Prevention

When it happens

Trigger: Query pipeline requests unload (e.g. downloading pre-aggregation results) but PrestoDriver.config.exportBucket is undefined — no CUBEJS_EXPORT_BUCKET-style config or exportBucket option provided to the driver.

Common situations: Running queries that trigger the export path in dev/local environments without bucket configuration; forgetting exportBucket settings when enabling pre-aggregation unload; isUnloadSupported returning false upstream being bypassed by direct unload calls.

Related errors


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