yoshidan / google-cloud-rust

Google Cloud Client Libraries for Rust.
MIT License
243 stars 87 forks source link

WithAuthExt doesn't work? #170

Closed aviramha closed 1 year ago

aviramha commented 1 year ago

I get the following error:

cargo build
   Compiling pubsub-example v0.1.0 (/Users/aviramhassan/Code/mirrord-intellij/pubsub-example)
error[E0599]: no method named `with_auth` found for struct `ClientConfig` in the current scope
 --> src/main.rs:6:42
  |
6 |     let config = ClientConfig::default().with_auth().await.unwrap();
  |                                          ^^^^^^^^^ method not found in `ClientConfig`

warning: unused import: `google_cloud_default::WithAuthExt`
 --> src/main.rs:2:5
  |
2 | use google_cloud_default::WithAuthExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

For more information about this error, try `rustc --explain E0599`.
warning: `pubsub-example` (bin "pubsub-example") generated 1 warning
error: could not compile `pubsub-example` due to previous error; 1 warning emitted

src/main.rs:

use google_cloud_pubsub::client::{ClientConfig, Client};
use google_cloud_default::WithAuthExt;

#[tokio::main]
async fn main() {
    let config = ClientConfig::default().with_auth().await.unwrap();
    let client = Client::new(config).await.unwrap();
}

Cargo.toml:


[package]
name = "pubsub-example"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
google-cloud-pubsub = "0.15"
google-cloud-default = { version = "0.4", features = ["pubsub"] }
tokio = { version = "1.28.2", features = ["full"] }

cargo version:

cargo --version
cargo 1.69.0 (6e9a83356 2023-04-12)
yoshidan commented 1 year ago

google-cloud-default 0.4 supports google-cloud-pubsub 0.16. Please use google-cloud-pubsub = "0.16" instead of 0.15.

https://github.com/yoshidan/google-cloud-rust/blob/8e62fe1defc8a2b4b56fb0e65bfa78201ffd78a6/default/Cargo.toml#L22

aviramha commented 1 year ago

google-cloud-default 0.4 supports google-cloud-pubsub 0.16.

Please use google-cloud-pubsub = "0.16" instead of 0.15.

https://github.com/yoshidan/google-cloud-rust/blob/8e62fe1defc8a2b4b56fb0e65bfa78201ffd78a6/default/Cargo.toml#L22

Thanks! Maybe it's better if the pubsub will implement the trait instead of the default?

yoshidan commented 1 year ago

Maybe it's better if the pubsub will implement the trait instead of the default?

We were considering making each crates(storage,pubsub,spanner,bigquery) features, but we decided to make them separate crates as google-cloud-default because each crates also needs to be upgraded together when google-cloud-auth is modified. Is google-cloud-default difficult to use?

aviramha commented 1 year ago

Maybe it's better if the pubsub will implement the trait instead of the default?

We were considering making each crates(storage,pubsub,spanner,bigquery) features, but we decided to make them separate crates as google-cloud-default because each crates also needs to be upgraded together when google-cloud-auth is modified.

Is google-cloud-default difficult to use?

I wouldn't say difficult but it wasn't intuitive for me that having different versions would break and also in a very misleading way. I think that the trait implementation should go into each crate so then it won't break like this

yoshidan commented 1 year ago

Thank you for your input. I asked several people and many of them said they would like it to be included in the features, so I will include it in the features.

yoshidan commented 1 year ago

I removed the google-cloud-default in this release