risingwavelabs/risingwave · critical

OSS_ENDPOINT not found from environment variables

Error message

OSS_ENDPOINT not found from environment variables

What it means

new_oss_engine panics when the OSS_ENDPOINT environment variable is unset or empty. The OSS object store engine requires an explicit endpoint URL (e.g. https://oss-cn-hangzhou.aliyuncs.com) to configure the OpenDAL OSS builder. The panic happens inside unwrap_or_else on std::env::var, so it aborts the process/task rather than returning ObjectResult::Err.

Source

Thrown at src/object_store/src/object/opendal_engine/oss.rs:38

use risingwave_common::config::ObjectStoreConfig;

use super::{MediaType, OpendalObjectStore, new_operator};
use crate::object::ObjectResult;
use crate::object::object_metrics::ObjectStoreMetrics;

impl OpendalObjectStore {
    /// create opendal oss engine.
    pub fn new_oss_engine(
        bucket: String,
        root: String,
        config: Arc<ObjectStoreConfig>,
        metrics: Arc<ObjectStoreMetrics>,
    ) -> ObjectResult<Self> {
        // Create oss backend builder.
        let mut builder = Oss::default().bucket(&bucket).root(&root);

        let endpoint = std::env::var("OSS_ENDPOINT")
            .unwrap_or_else(|_| panic!("OSS_ENDPOINT not found from environment variables"));
        let access_key_id = std::env::var("OSS_ACCESS_KEY_ID")
            .unwrap_or_else(|_| panic!("OSS_ACCESS_KEY_ID not found from environment variables"));
        let access_key_secret = std::env::var("OSS_ACCESS_KEY_SECRET").unwrap_or_else(|_| {
            panic!("OSS_ACCESS_KEY_SECRET not found from environment variables")
        });

        builder = builder
            .endpoint(&endpoint)
            .access_key_id(&access_key_id)
            .access_key_secret(&access_key_secret);

        let op = new_operator(
            &config,
            Operator::new(builder)?.layer(LoggingLayer::default()),
        );

        Ok(Self {
            op,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Export OSS_ENDPOINT to the regional OSS HTTPS endpoint before starting the process, e.g. export OSS_ENDPOINT='https://oss-cn-hangzhou.aliyuncs.com'.
  2. Add the variable to the deployment config (docker-compose env, k8s env, systemd Environment=) so it is always present.
  3. If the panic-on-missing behavior is undesirable, switch to a supported object store (S3, MinIO) or modify oss.rs to return an ObjectError instead of panicking.

Example fix

// before
let endpoint = std::env::var("OSS_ENDPOINT")
    .unwrap_or_else(|_| panic!("OSS_ENDPOINT not found from environment variables"));
// after (shell, before launch)
export OSS_ENDPOINT=https://oss-cn-hangzhou.aliyuncs.com
Defensive patterns

Strategy: validation

Validate before calling

if std::env::var("OSS_ENDPOINT").map(|v| v.is_empty()).unwrap_or(true) {
    return Err(anyhow!("OSS_ENDPOINT must be set to use object_store=oss"));
}

Prevention

When it happens

Trigger: Calling new_oss_engine (via ObjectStore::new / S3ObjectStore selection with OSS engine) when the OSS_ENDPOINT env var is not set in the process environment.

Common situations: Starting RisingWave with object_store=oss but forgetting to export OSS_ENDPOINT in the shell, systemd unit, or container image; running tests locally where only S3 env vars are 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 risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/ce9d08d3a30016d0. Report an issue: GitHub.