Non-intuitive Error Message When Using HTTP with ObjectStore
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Describe the bug
When attempting to use the object_store crate with an HTTP URL, the error message returned is non-intuitive. The error is caused by the object_store crate enforcing HTTPS, but the error message does not clearly indicate this. Instead, it returns a generic error message that can be confusing to users.
Error Message:
```
ObjectStore(Generic { store: "HTTP", source: Request { source: Reqwest { retries: 0, max_retries: 10, elapsed: 65.417µs, retry_timeout: 180s, source: reqwest::Error { kind: Builder, url: "http://127.0.0.1:3000/hits_0.parquet", source: BadScheme } } } })
```
### To Reproduce
Set up a local HTTP server serving a Parquet (or whatever) file at `http://127.0.0.1:3000/hits_0.parquet`.
Use the following code snippet to attempt to register the Parquet file with a DataFusion context:
```rust
use std::sync::Arc;
use datafusion::prelude::{ParquetReadOptions, SessionConfig, SessionContext};
use object_store::http::HttpBuilder;
use url::Url;
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
let mut config = SessionConfig::new();
let ctx = SessionContext::new_with_config(config);
let base_url = Url::parse("http://127.0.0.1:3000/").unwrap();
let object_store = HttpBuilder::new()
.with_url(base_url.clone())
.build()
.unwrap();
ctx.register_object_store(&base_url, Arc::new(object_store));
ctx.register_parquet(
"hits",
"http://127.0.0.1:3000/hits_0.parquet",
ParquetReadOptions::default()
).await?;
Ok(())
}
```
### Expected behavior
The error should be raised after the object store has been retrieved, and it should clearly indicate that the issue is related to the use of HTTP instead of HTTPS. A more intuitive error message would help users quickly identify and resolve the issue.
### Additional context
Config Option: https://docs.rs/object_store/0.11.2/object_store/enum.ClientConfigKey.html
Contributor guide
Research direction
Start at the HttpBuilder and SessionContext.register_object_store/register_parquet flow described in the reproduction, then trace where the object-store error is surfaced. Reproduce the problem against the local HTTP URL and verify that the resulting error clearly identifies the HTTP-versus-HTTPS issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100