{"record":{"id":"db1ad2561f3c3354","repo":"quickwit-oss/quickwit","slug":"unable-to-sniff-region-from-environment","errorCode":null,"errorMessage":"unable to sniff region from environment","messagePattern":"unable to sniff region from environment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-indexing/src/source/kinesis/kinesis_source.rs","lineNumber":366,"sourceCode":"    }\n}\n\npub(super) async fn get_region(\n    region_or_endpoint_opt: Option<RegionOrEndpoint>,\n) -> anyhow::Result<RegionOrEndpoint> {\n    if let Some(region_or_endpoint) = region_or_endpoint_opt {\n        return Ok(region_or_endpoint);\n    }\n    //< We fallback to AWS region if `region_or_endpoint` is `None`\n    let sdk_config = get_aws_config().await;\n\n    if let Some(region) = sdk_config.region() {\n        return Ok(RegionOrEndpoint::Region(region.to_string()));\n    }\n    if let Some(endpoint) = sdk_config.endpoint_url() {\n        return Ok(RegionOrEndpoint::Endpoint(endpoint.to_string()));\n    }\n    bail!(\"unable to sniff region from environment\")\n}\n\n#[cfg(all(test, feature = \"kinesis-localstack-tests\"))]\nmod tests {\n\n    use quickwit_actors::Universe;\n    use quickwit_config::{SourceConfig, SourceParams};\n    use quickwit_metastore::checkpoint::SourceCheckpointDelta;\n    use quickwit_proto::types::IndexUid;\n\n    use super::*;\n    use crate::actors::DocProcessor;\n    use crate::models::RawDocBatch;\n    use crate::source::SourceActor;\n    use crate::source::kinesis::helpers::tests::{\n        make_shard_id, put_records_into_shards, setup, teardown,\n    };\n    use crate::source::tests::SourceRuntimeBuilder;","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-indexing/src/source/kinesis/kinesis_source.rs#L348-L384","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["Set the AWS region: `AWS_REGION=us-east-1` (or `AWS_DEFAULT_REGION`) in the indexer environment.","Add `region = us-east-1` to the active profile in ~/.aws/config.","If using a Kinesis-compatible endpoint, set the endpoint URL so `get_region` can resolve it.","Re-run `quickwit source check-connectivity` after fixing the environment."],"exampleFix":"// before (no region set)\nAWS_ACCESS_KEY_ID=...\nAWS_SECRET_ACCESS_KEY=...\n// after\nAWS_REGION=us-east-1\nAWS_ACCESS_KEY_ID=...\nAWS_SECRET_ACCESS_KEY=...","handlingStrategy":"validation","validationCode":"test -n \"$AWS_REGION\" -o -n \"$AWS_DEFAULT_REGION\" && echo region set || echo 'set AWS_REGION before starting the indexer'","typeGuard":null,"tryCatchPattern":"// pre-flight before source creation\nif std::env::var(\"AWS_REGION\").is_err() && std::env::var(\"AWS_DEFAULT_REGION\").is_err() {\n    bail!(\"Kinesis source requires AWS_REGION or a configured AWS profile\");\n}","preventionTips":["Always set AWS_REGION in indexer/container environments.","Configure a region in ~/.aws/config for bare-metal deployments.","Set the endpoint URL explicitly when using Kinesis-compatible services."],"tags":["aws","kinesis","region","missing-env-var","rust"],"backgroundTag":"missing-env-var","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}