-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make the tonic-web layer axum compatible #2157
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
base: master
Are you sure you want to change the base?
Conversation
I try your PR, and tonic doesn't build |
It does for me. Can you please share your compile error? |
Finally tonic build if I only update tonic-web crate to your fork.
|
Can you share the code or provide a sample, in which this fork doesn't work? |
Line 662: There is no variable named "layer". Do you mean "cors_layer"? This crate only modifies parts of the "tonic-web" crate. |
There is no axum feature: https://github.com/MarkusTieger/tonic/blob/master/tonic-web/Cargo.toml. Even there are no features (same on grpc-web crate) btw, I update with your comment
logs: https://github.com/Ludea/speedupdate-rs/actions/runs/13859610820/job/38784557650#step:4:698 |
The dependency "axum" is marked as optional in tonic-web, which automatically defines a feature. Just add "axum" to features in tonic-web. |
Already done : https://github.com/Ludea/speedupdate-rs/blob/master/server/Cargo.toml#L22, but doesn't fix issue |
nvm it work as expected ! |
Motivation
So tonic-web can be used with axum-multiplexing.
For example: (GenericAuthenticationServiceServer and GenericAuthenticationService are from my own project, don't get confused)
Solution
With this pr you can just
.layer(GrpcWebLayer::new())
on a normal axum router (as long as the axum feature is enabled)Fixes #1964