meilisearch / meilisearch-rust

Rust wrapper for the Meilisearch API.

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index::add_documents_csv panics when File streaming

Fyko opened this issue · comments

Description
When attempting to call Index::add_documents_csv with a File, meilisearch-sdk panics.

Reproducable Example
https://gist.github.com/Fyko/cdaa113505dcca334372b18896381266#file-readme-md

Screenshots or Logs

Error

  2023-10-20T23:36:48.526475Z DEBUG isahc::agent: agent took 77.397µs to start up
    at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/isahc-1.7.2/src/agent/mod.rs:125 on isahc-agent-0
    in isahc::agent::agent_thread with id: 0

  2023-10-20T23:36:48.526603Z DEBUG isahc::handler:   Trying [::1]:7700...
    at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/isahc-1.7.2/src/handler.rs:653 on isahc-agent-0
    in isahc::handler::handler with id: 0
    in isahc::client::send_async with method: POST, uri: http://localhost:7700/indexes/testing/documents?primaryKey=id

  2023-10-20T23:36:48.526682Z DEBUG isahc::handler: Connected to localhost (::1) port 7700
    at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/isahc-1.7.2/src/handler.rs:653 on isahc-agent-0
    in isahc::handler::handler with id: 0
    in isahc::client::send_async with method: POST, uri: http://localhost:7700/indexes/testing/documents?primaryKey=id

thread 'isahc-agent-0' panicked at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/fs/file.rs:545:47:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  2023-10-20T23:36:48.527777Z ERROR isahc::agent: agent shut down with error: Error { kind: Unknown, context: None, source: Some(MultiError { description: "Operation was aborted by an application callback", code: 11 }), source_type: Some("curl::error::MultiError"), local_addr: None, remote_addr: None }
    at /home/carter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/isahc-1.7.2/src/agent/mod.rs:130 on isahc-agent-0
    in isahc::agent::agent_thread with id: 0

Error: HTTP request failed: unknown error

Meilisearch Debug Logs

[2023-10-20T23:38:01Z DEBUG meilisearch::routes::indexes::documents] called with params: AwebQueryParameter(UpdateDocumentsQuery { primary_key: Some("id"), csv_delimiter: None }, PhantomData<*const meilisearch_types::deserr::DeserrError<meilisearch_types::deserr::DeserrQueryParam, meilisearch_types::error::deserr_codes::BadRequest>>)
[2023-10-20T23:38:01Z DEBUG actix_web::middleware::logger] Error in response: ResponseError { code: 400, message: "A csv payload is missing.", error_code: "missing_payload", error_type: "invalid_request", error_link: "https://docs.meilisearch.com/errors#missing_payload" }
[2023-10-20T23:38:01Z INFO  actix_web::middleware::logger] 172.21.0.1 "POST /indexes/testing/documents?primaryKey=id HTTP/1.1" 400 150 "-" "Meilisearch Rust (v0.24.2)" 0.000790

Environment

  • OS: Ubuntu 22.04.3 LTS on Windows 10 [WSL2] (in Docker)
  • Meilisearch version: 1.4.2
  • meilisearch-rust version: 0.24.2

Relavent Commits
476ee7f

Hello @Fyko
thanks for the detailed report!

PRs are welcome to fix the bug! ❤️

commented

Hello @Fyko, this should be fixed after #563

Feel free to re-open if it’s not the case