ory / ory/sdk

[Rust] seperate client SDK dependency gap

Open
#422 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

I was trying to use all the ory client SDKs seperately, since I have a self hosted solution. But I noticed that the dependencies of the different rust clients do not match each other. Specifically the version of reqwest diverges between the crates.
ory-kratos-client and ory-oathkeeper-client use reqwest version "0.12"
ory-keto-client and ory-hydra-client use reqwest version "0.11"

Since rust uses ^ matching in semvers by default the latter can not upgrade to the former. And therefore two different reqwest versions are necessary to all the client SDKs.

This might be related to #417
Looking into the versions of the repository and crates.io I noticed that, taking hydra as example, that the repository: https://github.com/ory/hydra-client-rust has a git tag "2.2.1" but the latest crates.io version is "2.2.0". The repo even has a "2.4.0-alpha.1" tag.

Reproducing the bug

In a new project:

  1. cargo add ory-kratos-client and cargo add ory-keto-client and `car
  2. edit main.rs to:
use ory_keto_client::apis::configuration::Configuration as KetoConfiguration;
use ory_kratos_client::apis::configuration::Configuration as KratosConfiguration;

fn main() {
    let kratos_config = KratosConfiguration {
        client: reqwest::Client::new(),
        ..Default::default()
    };
    let keto_config = KetoConfiguration {
        client: reqwest::Client::new(),
        ..Default::default()
    };
}
  1. run cargo run
Relevant log output
$ cargo run

error[E0308]: mismatched types
  --> src/main.rs:10:17
   |
10 |         client: reqwest::Client::new(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^ expected `reqwest::async_impl::client::Client`, found `Client`
   |
note: two different versions of crate `reqwest` are being used; two types coming from two different versions of the same crate are different types even if they look the same
  --> /home/cschmidler/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/reqwest-0.12.15/src/async_impl/client.rs:77:1
   |
77 | pub struct Client {
   | ^^^^^^^^^^^^^^^^^ this is the found type `Client`
   |
  ::: /home/cschmidler/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/reqwest-0.11.27/src/async_impl/client.rs:69:1
   |
69 | pub struct Client {
   | ^^^^^^^^^^^^^^^^^ this is the expected type `reqwest::async_impl::client::Client`
   |
  ::: src/main.rs:1:5
   |
1  | use ory_keto_client::apis::configuration::Configuration as KetoConfiguration;
   |     --------------- one version of crate `reqwest` used here, as a dependency of crate `ory_keto_client`
...
6  |         client: reqwest::Client::new(),
   |                 ------- one version of crate `reqwest` used here, as a direct dependency of the current crate
   = help: you can use `cargo tree` to explore your dependency tree

For more information about this error, try `rustc --explain E0308`.
error: could not compile `ory-ver-mismatch` (bin "ory-ver-mismatch") due to 1 previous error

Relevant log output
$ cargo tree -i reqwest

error: There are multiple `reqwest` packages in your project, and the specification `reqwest` is ambiguous.
Please re-run this command with one of the following specifications:
  reqwest@0.11.27
  reqwest@0.12.15
Version

ory-keto-client = "0.11.0-alpha.0" and ory-kratos-client = "1.3.8"

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker Compose

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduced example in main.rs and use cargo tree to inspect the reqwest versions pulled in by ory-kratos-client, ory-oathkeeper-client, ory-keto-client, and ory-hydra-client. Compare the repository tags and crates.io versions mentioned in the issue. Done means the client SDKs can be used together with compatible reqwest types rather than requiring separate versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.