tvallotton / rocket_auth

An implementation for an authentication API for Rocket applications.
https://docs.rs/rocket_auth/
Apache License 2.0
73 stars 35 forks source link

Compilation failing due to SQLX features #54

Open modulated opened 1 year ago

modulated commented 1 year ago

Hi,

I am attempting to use rocket_auth within a project already using Sqlx 0.6.1 and getting the following error:

error: one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', 'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', 'runtime-tokio-rustls'] must be enabled
  --> /Users/george/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-rt-0.5.13/src/lib.rs:9:1
   |
9  | / compile_error!(
10 | |     "one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
11 | |      'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', \
12 | |      'runtime-tokio-rustls'] must be enabled"
13 | | );
   | |_^

I was able to fix this error by locally cloning the rocket_auth repository and adding in the following to the SQLX dependency section

[dependencies.sqlx]
version = "0.6.0"
optional = true
features = ["runtime-tokio-rustls"]

This is my dependencies (edited for brevity):

[dependencies]
rocket = {version = "0.5.0-rc.1", features = ["json"]}
rocket_auth = {path = "../rocket_auth", features = ["sqlx-sqlite"]}
serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0"
tokio = {version = "1.17", features = ["full"]}
sqlx = {version = "0.6", features = ["runtime-tokio-rustls", "sqlite"]}

Just wondering if this is some perculiarity in the way my project is set up or is this a new bug?

EnricoMucelli commented 1 year ago

THANK YOU!!! i was wondering how to resolve this for days i think this is totally a new bug @tvallotton

hack-wrench commented 1 year ago

Until it is fixed, you can use my fork with minimal diffs: https://github.com/hack-wrench/rocket_auth_fixed

[dependencies.rocket_auth]
git = "https://github.com/hack-wrench/rocket_auth_fixed"
features = ["sqlx-sqlite"]