SeaQL/sea-orm

Missing downward feature `runtime-tokio`.

xuxiaocheng0201 opened this issue · 4 comments

Description

Enabled runtime-tokio in sea-orm but panics

either the `runtime-async-std` or `runtime-tokio` feature must be enabled

in sqlx-core.

Steps to Reproduce

  1. Add sea-orm = { version = "1.0.0-rc.3", features = ["sqlx-sqlite", "runtime-tokio"] } to Cargo.toml
  2. In main.rs:
use sea_orm::Database;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let connection = Database::connect("sqlite://1.db?mode=rwc").await?;
    connection.ping().await?;
    Ok(())
}
  1. Compile and run.

Expected Behavior

Normally run.

Actual Behavior

Panic:

thread 'main' panicked at D:\AppData\Languages\Cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.4\src\pool\inner.rs:52:24:
either the `runtime-async-std` or `runtime-tokio` feature must be enabled
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduces How Often

Always.

Workarounds

Missing downward feature.

Reproducible Example

Codes above.

Versions

I tested 1.0.0-rc.3 and 0.12.15, both had this problem.

Hey @xuxiaocheng0201, runtime-tokio is just a placeholder feature. It did nothing behind the scene. Please enable one of

  • runtime-tokio-native-tls
  • runtime-tokio-rustls

sea-orm/Cargo.toml

Lines 116 to 126 in 0ff000b

runtime-tokio = []
runtime-tokio-native-tls = [
"sqlx?/runtime-tokio-native-tls",
"sea-query-binder?/runtime-tokio-native-tls",
"runtime-tokio",
]
runtime-tokio-rustls = [
"sqlx?/runtime-tokio-rustls",
"sea-query-binder?/runtime-tokio-rustls",
"runtime-tokio",
]

Hey @xuxiaocheng0201, runtime-tokio is just a placeholder feature. It did nothing behind the scene. Please enable one of

  • runtime-tokio-native-tls
  • runtime-tokio-rustls

Thanks @billy1624 .

But I only use the sqlite backend, which needn't tls.

Enable runtime-tokio-native-tls or runtime-tokio-rustls
resulted in additional unnecessary dependencies.

I see what you mean now. I just drafted a PR, would you like to try it? #2175

Fixed in #2171