agent-rs icon indicating copy to clipboard operation
agent-rs copied to clipboard

ic-agent doesn't work anymore due to incompatibilities between reqwest 0.11.7 and rustls 0.19.1

Open MarioDfinity opened this issue 4 years ago • 0 comments

I tested today ic-agent 0.10.0 and when I tried to create a transport via ReqwestHttpReplicaV2Transport::create(url) I got the error

'Could not create HTTP client.: reqwest::Error { kind: Builder, source: "Unknown TLS backend passed to `use_preconfigured_tls`" }'

I found out that the reason is that ic-agent depends on reqwest 0.11 and rustls 0.19.1 but the newer reqwest (0.11.7) uses rustls 0.20.1. ic-agent uses the following code to instantiate a transport

reqwest::Client::builder().use_preconfigured_tls(tls_config)

and the method use_preconfigured_tls docs says:

This is an advanced option, and can be somewhat brittle. Usage requires keeping the
preconfigured TLS argument version in sync with reqwest, since version mismatches
will result in an “unknown” TLS backend.

A fix for this is to enforce the version of reqwest to be =0.11.6 (I tested this locally). Another solution is to bump rustls but the newer version has a different API.

I would also suggest to either not use use_preconfigured_tls or always fix the versions of reqwest and rustls to avoid having this issue again.

MarioDfinity avatar Dec 02 '21 19:12 MarioDfinity