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

Compilation error when using async-nats as a library (related: tokio-rustls, rustls) #1090

Closed
nickgerace opened this issue Aug 14, 2023 · 5 comments
Labels
bug Confirmed reproducible bug

Comments

@nickgerace
Copy link

NATS version

0.31.0

rustc version

rustc 1.70.0 (90c541806 2023-05-31)

OS/Container environment

macOS 13.5

Steps or code to reproduce the issue

  1. Use version 0.31.0
  2. See that rustls version 0.21.1 is being used instead of a newer version that provides the missing method below
  3. Observe the following error:
error[E0599]: no method named `with_client_auth_cert` found for struct `ConfigBuilder` in the current scope
--
  | --> third-party/rust/async-nats-0.31.0.crate/src/tls.rs:117:29
  | \|
  | 117 \|                     builder.with_client_auth_cert(cert, key).map_err(\|_\| {
  | \|                             ^^^^^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `with_no_client_auth`

Expected result

Success compilation.

Actual result

The error observed above.

@nickgerace nickgerace added bug Confirmed reproducible bug needs triage labels Aug 14, 2023
@paulocsanz
Copy link

paulocsanz commented Aug 14, 2023

From my understanding what is going on here is that async-nats is using tokio-rustls 0.24 which pins rustls to 0.21.0.

But async-nats is using a feature from rustls that exists in 0.21.6 but not in 0.21.0.

Since it's a minor version bump, cargo seems ok to sometimes use the latest version instead of the one pinned, that's why this project compiles in some environments.

There was something going on in our enviroment, maybe a different dependency using rustls 0.21.1, so rust didn't update it to 0.21.6 when installing async-nats, because it didn't "need" to.

If async-nats wants to use a feature from a rustls version that's not exactly the one pinned in tokio-tls's cargo toml, it has to explicitly add it as a dependency, so adding rustls = "0.24.6" to async-nats cargo toml.

We added this line to our cargo toml and it fixed it, but the issue originates from this repo.

@paolobarbolini
Copy link
Contributor

paolobarbolini commented Aug 14, 2023

We added this line to our cargo toml and it fixed it, but the issue originates from this repo.

FYI if you're making a binary crate you can do cargo update -p rustls. It won't invalidate everything else you said but at least you won't need to add a line in Cargo.toml

@nepalez
Copy link
Contributor

nepalez commented Sep 20, 2023

It should be fixed here #1108

@barafael
Copy link
Contributor

@nickgerace can this issue be closed?

@nickgerace
Copy link
Author

I believe so!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed reproducible bug
Projects
None yet
Development

No branches or pull requests

6 participants