cube-js/cube · error

Unsupported exportBucket configuration, some keys are empty:

Error message

Unsupported exportBucket configuration, some keys are empty: integrationName|sasToken

What it means

When configuring a Snowflake export bucket for Azure storage, the driver requires either a storage integration name (dbExportIntegration) or a SAS token (dbExportAzureSasToken); both were empty, so the bucket config is unsupported. For Azure, integrationName and sasToken are each optional, but at least one must be present.

Source

Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:312

    if (bucketType === 'gcs') {
      // integrationName is required for gcs as the only possible way in snowflake
      return {
        bucketType,
        bucketName: getEnv('dbExportBucket', { dataSource, preAggregations }),
        integrationName: getEnv('dbExportIntegration', { dataSource, preAggregations }),
        credentials: getEnv('dbExportGCSCredentials', { dataSource, preAggregations }),
      };
    }

    if (bucketType === 'azure') {
      // integrationName is optional for azure
      const integrationName = getEnv('dbExportIntegration', { dataSource, preAggregations });
      // sasToken is optional for azure if storage integration is used
      const sasToken = getEnv('dbExportAzureSasToken', { dataSource, preAggregations });

      if (!integrationName && !sasToken) {
        throw new Error(
          'Unsupported exportBucket configuration, some keys are empty: integrationName|sasToken'
        );
      }

      // azureKey is optional if DefaultAzureCredential() is used
      const azureKey = getEnv('dbExportBucketAzureKey', { dataSource, preAggregations });

      // These 3 options make sense in case you want to authorize to Azure from
      // application running in the k8s environment.
      const clientId = getEnv('dbExportBucketAzureClientId', { dataSource, preAggregations });
      const tenantId = getEnv('dbExportBucketAzureTenantId', { dataSource, preAggregations });
      const tokenFilePath = getEnv('dbExportBucketAzureTokenFilePAth', { dataSource, preAggregations });

      return {
        bucketType,
        bucketName: getEnv('dbExportBucket', { dataSource, preAggregations }),
        ...(integrationName !== undefined && { integrationName }),
        ...(sasToken !== undefined && { sasToken }),

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Set CUBEJS_DB_EXPORT_INTEGRATION to your Snowflake Azure storage integration name, or
  2. Set CUBEJS_DB_EXPORT_AZURE_SAS_TOKEN with a valid SAS token
  3. Create the storage integration in Snowflake (CREATE STORAGE INTEGRATION) and grant the container access if you don't have one
  4. Double-check the exact env var names and that they're loaded into the server process

Example fix

# before
CUBEJS_DB_EXPORT_BUCKET_TYPE=azure
CUBEJS_DB_EXPORT_BUCKET=mycontainer

# after
CUBEJS_DB_EXPORT_BUCKET_TYPE=azure
CUBEJS_DB_EXPORT_BUCKET=mycontainer
CUBEJS_DB_EXPORT_INTEGRATION=AZURE_STORAGE_INTEGRATION
Defensive patterns

Strategy: validation

Validate before calling

const bucketType = process.env.CUBEJS_DB_EXPORT_BUCKET_TYPE;
if (bucketType === 'azure') {
  const integration = process.env.CUBEJS_DB_EXPORT_INTEGRATION;
  const sasToken = process.env.CUBEJS_DB_EXPORT_AZURE_SAS_TOKEN;
  if (!integration && !sasToken) {
    throw new Error('Azure export bucket requires CUBEJS_DB_EXPORT_INTEGRATION or CUBEJS_DB_EXPORT_AZURE_SAS_TOKEN');
  }
}

Try / catch

try {
  driver.exportBucket({ /* ... */ });
} catch (e) {
  if (e.message.includes('integrationName|sasToken')) {
    console.error('Set dbExportIntegration or dbExportAzureSasToken for Azure export buckets');
  }
  throw e;
}

Prevention

When it happens

Trigger: Setting EXPORT_BUCKET_TYPE=azure (CUBEJS_DB_EXPORT_BUCKET_TYPE) for Snowflake pre-aggregation exports without setting CUBEJS_DB_EXPORT_INTEGRATION or CUBEJS_DB_EXPORT_AZURE_SAS_TOKEN.

Common situations: Copying an S3/GCS export-bucket env template to Azure and only setting bucket/container names; forgetting the storage integration created in Snowflake; SAS token expired/removed from env leaving both keys empty.

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