titanous / grpc-web-client Goto Github PK
View Code? Open in Web Editor NEWgRPC-Web client in Rust
License: MIT License
gRPC-Web client in Rust
License: MIT License
Looks like something changed in tonic 0.7.0 - I get this sort of error now:
38 | pub struct Client {
| -----------------
| |
| doesn't satisfy `<_ as Service<tonic::codegen::http::Request<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>>>::Response = tonic::codegen::http::Response<_>`
| doesn't satisfy `_: GrpcService<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>`
| doesn't satisfy `_: Service<tonic::codegen::http::Request<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>>`
|
= note: the following trait bounds were not satisfied:
`grpc_web_client::Client: GrpcService<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>`
`<grpc_web_client::Client as Service<tonic::codegen::http::Request<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>>>::Response = tonic::codegen::http::Response<_>`
`grpc_web_client::Client: Service<tonic::codegen::http::Request<http_body::combinators::box_body::UnsyncBoxBody<tonic::codegen::Bytes, Status>>>`
So as you probably know from hyperium/tonic#645, I am trying to use this well before it's integrated into Tonic! I have tried integrating it into a simple Yew application without success so far. I'm reporting this because maybe it's relevant to your PR.
I get this error when even just writing an async fn for calling a test endpoint, without calling it:
the trait `Service<yew::services::fetch::Request<http_body::combinators::box_body::BoxBody<bytes::bytes::Bytes, Status>>>` is not implemented for `Client`
yew::services::fetch::Request
is a re-exported http::Request
. But I have no idea what Service
is or where it comes from. One person guessed tokio-tower. I tried disabling the services
feature of Yew, too. The error still occurs.
tonic recently changed response's body to UnsyncBody
i guess that creates a lot of issues for this library.
On localhost I dont get these errors - but while running my application over the web I am getting tonic error. Have you encountered these errors? will they be fixed by updating to latest version.
These are the tonic errors being printed to console
status: Internal, message: "Unexpected compression flag: 128, while receiving response with status: 200 OK", details: [], metadata: MetadataMap { headers: {} }
status: Internal, message: "Unexpected EOF decoding stream.", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc-web+proto", "date": "Fri, 05 Nov 2021 15:43:00 GMT", "vary": "Origin, Origin", "x-cosmos-block-height": "3151041"} }
Currently using version 0.1.2.
The code in the repo uses tonic 0.6.2, but the version on crates.io uses 0.4.2.
My project successfully builds and passes tests with:
grpc-web-client = { git = "https://github.com/titanous/grpc-web-client" }
but fails with:
grpc-web-client = "0.1.2"
I think you just need to bump to 0.1.3 and re-release.
Current released version uses tonic v0.4
.
Hello, I have been using your crate (:pray: ) to implement a grpc client and compiling it to wasm.
All works fine with http, but to use https I need to enable tls
and tls-roots
features on tonic,
but once I do that the build targeting wasm fails.
Here the build logs and the relevant Cargo.toml section:
https://gist.github.com/noandrea/ce571ece948e309c54c4ce5958c3c3c2
the src project is here https://github.com/noandrea/cosmos-cash-credentials/tree/feat/grpc
do you know if it is a way around this?
I am trying to catch errors from the server side, I sent a status "unauthenticated" (code 16) with message "ExpiredSignature"
Received error message from grpc-web-client:
status: Unknown, message: "FetchFailed(JsValue(TypeError: Failed to fetch\nTypeError: Failed to fetch))", details: [], metadata: MetadataMap { headers: {} }
response header:
grpc-status: 16
grpc-message: ExpiredSignature
content-length: 0
date: Mon, 09 Aug 2021 12:06:47 GM
The response header is ok, but the error message needs more treatment, perhaps need to catch response headers and put it into the error message
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.