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

Broken Example Code Due to Missing Module in crates.io Version #2177

Open
arthurgubaidullin opened this issue Feb 6, 2025 · 0 comments
Open

Comments

@arthurgubaidullin
Copy link

arthurgubaidullin commented Feb 6, 2025

Bug Report

Version

0.12.3

Platform

aarch64 GNU/Linux

Crates

https://crates.io/crates/tonic

Description

I tried running the example code from this repository, but it doesn't work because a required module is missing, and it isn't available in the version on crates.io. I spent hours troubleshooting and found that the latest release was in September 2024. It turns out that the examples are using a version that isn't from crates.io.

I expect the example code to be functional and up to date. The links in the documentation lead to non-working examples. Please update the examples or provide guidance on how to resolve the issue.

error[E0432]: unresolved import `tonic::service::LayerExt`
 --> experiments/grpc-server/src/main.rs:1:13
  |
1 | use tonic::{service::LayerExt as _, transport::Server, Request, Response, Status};
  |             ^^^^^^^^^^^^^^^^^^^^^^ no `LayerExt` in `service`

error[E0599]: no method named `named_layer` found for struct `Stack` in the current scope
  --> experiments/grpc-server/src/main.rs:42:10
   |
38 |       let greeter = tower::ServiceBuilder::new()
   |  ___________________-
39 | |         .layer(tower_http::cors::CorsLayer::new())
40 | |         .layer(tonic_web::GrpcWebLayer::new())
41 | |         .into_inner()
42 | |         .named_layer(GreeterServer::new(greeter));
   | |         -^^^^^^^^^^^ method not found in `Stack<GrpcWebLayer, Stack<CorsLayer, Identity>>`
   | |_________|
   |

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.

Related PR: #1966

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

No branches or pull requests

1 participant