devashishdxt / tonic-web-wasm-client

Other
104 stars 28 forks source link

issues creating new client instance #45

Closed borngraced closed 1 year ago

borngraced commented 1 year ago

I have my code setup correctly but creating new client CompactTxStreamerClient from Client results in an error.

weird because I confirm that this only works in the test_suite from the repo

fn build_client() -> CompactTxStreamerClient<Client> {
    let base_url = "http://localhost:50051".to_string();
    let wasm_client = Client::new(base_url);

    CompactTxStreamerClient::new(wasm_client.into())
}

ERROR

the trait bound `Client: Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, Status>>>` is not satisfied
the trait `Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::status::Status>>>` is implemented for `Client`
required for `Client` to implement `GrpcService<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, Status>>
devashishdxt commented 1 year ago

Thanks for creating this issue. Can you please mention the version of tonic and tonic-web-wasm-client that you're using?

borngraced commented 1 year ago

Thanks for creating this issue. Can you please mention the version of tonic and tonic-web-wasm-client that you're using?

[dependencies]
prost = "0.12.1"
tonic = { version = "0.10.1", default-features = false, features = [
    "prost",
    "codegen",
] }
tonic-web-wasm-client = "0.4.0"
wasm-bindgen-test = "0.3.34"

[build-dependencies]
tonic-build = { version = "0.10.1", default-features = false, features = [
    "prost",
] }
devashishdxt commented 1 year ago

In all probability, this is because you're using newer version of tonic. I've released 0.5.0 for tonic-web-wasm-client which should be compatible with newer tonic versions. Link.

borngraced commented 1 year ago

thanks working now.