Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] undeclared hyper-tls dependency of tauri causes failure with offline builds #12448

Open
oddlama opened this issue Jan 20, 2025 · 6 comments · May be fixed by #12445
Open

[bug] undeclared hyper-tls dependency of tauri causes failure with offline builds #12448

oddlama opened this issue Jan 20, 2025 · 6 comments · May be fixed by #12445
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@oddlama
Copy link

oddlama commented Jan 20, 2025

Describe the bug

I recently tried to package an application that was build with tauri, but in my build sandbox I encountered the following error:

    Info `tauri-build` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
    Info `tauri` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
error: no matching package found
searched package name: `hyper-tls`
perhaps you meant:      hyper-rustls or hyper-util
location searched: registry `crates-io`
required by package `reqwest v0.12.8`
    ... which satisfies dependency `reqwest = "^0.12.5"` (locked to 0.12.8) of package `firezone-gui-client-common v1.4.0 (/build/source/rust/gui-client/src-common)`
    ... which satisfies path dependency `firezone-gui-client-common` (locked to 1.4.0) of package `firezone-gui-client v1.4.0 (/build/source/rust/gui-client/src-tauri)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
    Error failed to build app:

For context, I pre-download all dependencies using cargo vendor and later build without network access, but for some reason that is unknown to me, tauri build seems to execute a cargo build that requires more than what I have in my lock file. Specifically, it will try to fetch hyper-tls which then fails. The obvious and simplest solution for me was to add hyper-tls to the project dependencies (either directly or by enabling tauri's native-tls feature), even though the project doesn't actually depend on it. This just makes sure the dependency is available in the vendored directory so tauri build can succeed.

I also cannot figure out how to remove this dependency, say if I wanted to use rustls instead hyper-tls which seems to pull in openssl. Unfortunately, I don't know enough about tauri to find the root cause for this. It does however seem like something that shouldn't be happening.

Reproduction

$ git clone https://github.com/firezone/firezone
$ git checkout 8c9427b7b133e5050be34c2ac0e831c12c08f02c
$ cd firezone/rust
$ cargo vendor          # follow instructions by cargo vendor and copy stuff to .cargo/config.toml
$ mkdir gui-client/dist # just a dummy, the error will happen way before we get to frontend stuff
$ cd gui-client
$ cargo tauri build -- --offline

    Info `tauri-build` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
    Info `tauri` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
error: no matching package found
searched package name: `hyper-tls`
perhaps you meant:      hyper-rustls or hyper-util
location searched: registry `crates-io`
required by package `reqwest v0.12.9`
    ... which satisfies dependency `reqwest = "^0.12.9"` (locked to 0.12.9) of package `firezone-gui-client-common v1.4.1 (/home/malte/firezone/rust/gui-client/src-common)`
    ... which satisfies path dependency `firezone-gui-client-common` (locked to 1.4.1) of package `firezone-gui-client v1.4.1 (/home/malte/firezone/rust/gui-client/src-tauri)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
    Error failed to build app:

Expected behavior

All dependencies should be declared.

Full tauri info output

[-] Packages
    - tauri 🦀: 2.2.2
    - tauri-build 🦀: 2.0.5
    - wry 🦀: 0.48.0
    - tao 🦀: 0.31.0
    - tauri-cli 🦀: 2.1.0
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : not installed!
    - tauri-plugin-notification 🦀: 2.2.0
    - @tauri-apps/plugin-notification : not installed!
    - tauri-plugin-shell 🦀: 2.2.0
    - @tauri-apps/plugin-shell : not installed!
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - bundler: Vite

Stack trace

N/A

Additional context

No response

@FabianLars
Copy link
Member

That's actually crazy timing, i just opened a PR yesterday to address this (though i didn't think about offline builds) #12445

I also cannot figure out how to remove this dependency, say if I wanted to use rustls instead hyper-tls which seems to pull in openssl.

add rustls-tls instead of native-tls

@oddlama
Copy link
Author

oddlama commented Jan 20, 2025

That's actually crazy timing, i just opened a PR yesterday to address this (though i didn't think about offline builds) #12445

Crazy coincidence indeed! Awesome that this is already being addressed.

I also cannot figure out how to remove this dependency, say if I wanted to use rustls instead hyper-tls which seems to pull in openssl.

add rustls-tls instead of native-tls

Oh I should have clarified that I did try that, but it still pulled in hyper-tls - and I wasn't able to figure out why. If you need a way to reproduce this, I tested it with the firezone repo example which I wrote about. I just added the feature flag to the tauri dependency in the workspace's Cargo.toml (rust/Cargo.toml).

@FabianLars
Copy link
Member

If i pull the contrib branch and change native-tls to rustls-tls cargo check removes hyper-tls from Cargo.lock:

Image

@oddlama
Copy link
Author

oddlama commented Jan 20, 2025

It does remove the hyper-tls dependency (which they already added upstream) from the Cargo.lock file again, but then still depends on it in the actual build. So this will cause a build error in offline mode. What I could not figure out is why it still depends on hyper-tls after enabling rustls-tls.

To reproduce you need to build in offline mode:

$ git clone https://github.com/firezone/firezone
$ git checkout 8c9427b7b133e5050be34c2ac0e831c12c08f02c
$ cd firezone/rust
$ nvim Cargo.toml # add rustls-tls to tauri features in Cargo.toml

$ cargo vendor
$ nvim .cargo/config.toml # copy output by cargo vendor and paste at end of file
$ mkdir gui-client/dist # just a dummy, the error will happen way before we get to frontend stuff
$ cd gui-client
$ cargo tauri build -- --offline

    Info `tauri-build` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
    Info `tauri` dependency has workspace inheritance enabled. The features array won't be automatically rewritten. Expected features: []
error: no matching package found
searched package name: `hyper-tls`
perhaps you meant:      hyper-rustls or hyper-util
location searched: registry `crates-io`
required by package `reqwest v0.12.9`
    ... which satisfies dependency `reqwest = "^0.12.9"` (locked to 0.12.9) of package `firezone-gui-client-common v1.4.1 (/home/malte/firezone/rust/gui-client/src-common)`
    ... which satisfies path dependency `firezone-gui-client-common` (locked to 1.4.1) of package `firezone-gui-client v1.4.1 (/home/malte/firezone/rust/gui-client/src-tauri)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
    Error failed to build app:

@FabianLars
Copy link
Member

ahh, that could be because of the workspace inheritance. The cli may not detect the features correctly here. Does this still happen if you do cargo install tauri-cli --debug --git https://github.com/tauri-apps/tauri --branch fix/nativetls ?

@oddlama
Copy link
Author

oddlama commented Jan 20, 2025

You're right, that seems to solve the issue! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants