Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing downward feature runtime-tokio. #2174

Closed
xuxiaocheng0201 opened this issue Mar 27, 2024 · 4 comments
Closed

Missing downward feature runtime-tokio. #2174

xuxiaocheng0201 opened this issue Mar 27, 2024 · 4 comments
Assignees

Comments

@xuxiaocheng0201
Copy link

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.

@billy1624
Copy link
Member

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",
]

@billy1624 billy1624 self-assigned this Mar 27, 2024
@xuxiaocheng0201
Copy link
Author

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.

@billy1624 billy1624 mentioned this issue Mar 27, 2024
2 tasks
@billy1624
Copy link
Member

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

@tyt2y3
Copy link
Member

tyt2y3 commented Mar 29, 2024

Fixed in #2171

@tyt2y3 tyt2y3 closed this as completed Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants