Closed codeBehindMe closed 1 month ago
HttpsUriWithoutTlsSupport
means that you have not enabled the tls
feature for tonic, and so it can't connect viahttps://
, only http://
. However, your endpoint probably expects HTTPS (since it is on port 443
).
You'll want to enable the tls
feature, and then configure your endpoint using Endpoint::tls_config
. You should take a look at the tls-roots
and tls-webpki-roots
features as well, which provide easy ways to configure your channel's TLS settings so that it can verify certificates.
Thanks @alexrudy , indeed adding tls-roots
to features and then updating the code to the following fixed the issue.
let endpoint = Channel::from_static("https://project-id-randomstring-ts.a.run.app:443")
.tls_config(tonic::transport::ClientTlsConfig::new().with_native_roots())?
.http2_keep_alive_interval(std::time::Duration::from_secs(10))
.connect()
.await?;
Bug Report
Version
tonic v0.12.1 tonic-build v0.12.1
Platform
Linux 3c99df5b0cc4 5.15.133.1-microsoft-standard-WSL2 # 1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 GNU/Linux
Description
Steps to reproduce
server.rs
and deploy the service to Google Cloud Run using gcloud deploy. Retrieve the URL.https://project-id-randomstring-ts.a.run.app:443
using theclient.rs
fileI tried this code:
Expected Behaviour: Return the response from the method
Instead, this happened:
Error: tonic::transport::Error(Transport, ConnectError(HttpsUriWithoutTlsSupport(())))