quickwit-oss/quickwit · error

unable to sniff region from environment

Error message

unable to sniff region from environment

What it means

The Kinesis source needs an AWS region to build its client. `get_region` first tries `sdk_config.region()` then `sdk_config.endpoint_url()`; if neither is set by the loaded AWS configuration, it bails because it cannot sniff the region from the environment.

Source

Thrown at quickwit/quickwit-indexing/src/source/kinesis/kinesis_source.rs:366

    }
}

pub(super) async fn get_region(
    region_or_endpoint_opt: Option<RegionOrEndpoint>,
) -> anyhow::Result<RegionOrEndpoint> {
    if let Some(region_or_endpoint) = region_or_endpoint_opt {
        return Ok(region_or_endpoint);
    }
    //< We fallback to AWS region if `region_or_endpoint` is `None`
    let sdk_config = get_aws_config().await;

    if let Some(region) = sdk_config.region() {
        return Ok(RegionOrEndpoint::Region(region.to_string()));
    }
    if let Some(endpoint) = sdk_config.endpoint_url() {
        return Ok(RegionOrEndpoint::Endpoint(endpoint.to_string()));
    }
    bail!("unable to sniff region from environment")
}

#[cfg(all(test, feature = "kinesis-localstack-tests"))]
mod tests {

    use quickwit_actors::Universe;
    use quickwit_config::{SourceConfig, SourceParams};
    use quickwit_metastore::checkpoint::SourceCheckpointDelta;
    use quickwit_proto::types::IndexUid;

    use super::*;
    use crate::actors::DocProcessor;
    use crate::models::RawDocBatch;
    use crate::source::SourceActor;
    use crate::source::kinesis::helpers::tests::{
        make_shard_id, put_records_into_shards, setup, teardown,
    };
    use crate::source::tests::SourceRuntimeBuilder;

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Set the AWS region: `AWS_REGION=us-east-1` (or `AWS_DEFAULT_REGION`) in the indexer environment.
  2. Add `region = us-east-1` to the active profile in ~/.aws/config.
  3. If using a Kinesis-compatible endpoint, set the endpoint URL so `get_region` can resolve it.
  4. Re-run `quickwit source check-connectivity` after fixing the environment.

Example fix

// before (no region set)
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
// after
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
Defensive patterns

Strategy: validation

Validate before calling

test -n "$AWS_REGION" -o -n "$AWS_DEFAULT_REGION" && echo region set || echo 'set AWS_REGION before starting the indexer'

Try / catch

// pre-flight before source creation
if std::env::var("AWS_REGION").is_err() && std::env::var("AWS_DEFAULT_REGION").is_err() {
    bail!("Kinesis source requires AWS_REGION or a configured AWS profile");
}

Prevention

When it happens

Trigger: `try_new` or `check_connectivity` calls `get_region` and the loaded `SdkConfig` has no region and no endpoint URL (no AWS_REGION env var, no ~/.aws/config region, no configured endpoint).

Common situations: Indexer container lacking AWS_REGION env var; no AWS profile configured on bare-metal deployments; using a custom endpoint but forgetting region; self-hosted Kinesis-compatible service without endpoint set.

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 quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/db1ad2561f3c3354. Report an issue: GitHub.