tauri-plugin-http fails with "schema is not http" after upgrade to 2.0.0-beta.4
slimandslam opened this issue · comments
HTTPS calls work fine at 2.0.0-beta.2, but after upgrading to 2.0.0-beta.4, the exact same code returns:
[Error] Failed to load resource: the server responded with a status of 400 (Bad Request) (plugin:http|fetch_send, line 0)
To Reproduce:
git clone https://github.com/slimandslam/openaiimages.git
then update the versions in the package.json and Cargo.toml files:
package.json
"@tauri-apps/api": "^2.0.0-beta.7",
"@tauri-apps/cli": "^2.0.0-beta.12",
Cargo.toml
tauri = { version = "2.0.0-beta.14", features = [] }
tauri-plugin-shell = { version = "2.0.0-beta.3", features = [] }
tauri-plugin-store = { version = "2.0.0-beta.4", features = [] }
tauri-plugin-dialog = { version = "2.0.0-beta.4", features = [] }
tauri-plugin-fs = { version = "2.0.0-beta.4", features = [] }
tauri-plugin-http = { version = "2.0.0-beta.4", features = [] }
You might have to enter a fake string for the OpenAI API key.
Press the submit button
ENVIRONMENT:
$ tauri info
[✔] Environment
- OS: Mac OS 14.4.0 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.76.0 (07dca489a 2024-02-04)
✔ cargo: 1.76.0 (c84b36747 2024-01-18)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.10.0
- pnpm: 8.13.1
- yarn: 1.22.21
- npm: 10.2.3
[-] Packages
- tauri [RUST]: 2.0.0-beta.14
- tauri-build [RUST]: 2.0.0-beta.11
- wry [RUST]: 0.39.0
- tao [RUST]: 0.27.0
- tauri-cli [RUST]: 2.0.0-beta.2
- @tauri-apps/api [NPM]: 2.0.0-beta.7
- @tauri-apps/cli [NPM]: 2.0.0-beta.12
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
[-] iOS
- Developer Teams: None
✨ Done in 3.72s.
can you inspect the request on the endpoint and check why it thinks its a bad request?
Also the provided repo is not minimal and doesn't include a server app that I can use to debug the behavior.
I don't think a server will matter because it doesn't look to me like the request ever leaves the plugin.
I did make an error in my original posting above. Instead of "the server responded with a status of 400", the actual error
should be:
error sending request for url (https://api.openai.com/v1/images/generations): error trying to connect: invalid URL, scheme is not http"
So, It looks like the plugin thinks that my URL should use "http" instead of "https" (?)
Hmm I was sure we had a GitHub issue about this already but doesn't look like it.
Anyway, you can change the plugin-http dep in cargo.toml to something like this to make it work
tauri-plugin-http = { version = "2.0.0-beta", features = ["rustls-tls"] }
nvm, we did have that here #1067
Thank you. Adding:
tauri-plugin-http = { version = "2.0.0-beta", features = ["rustls-tls"] }
to the Cargo.toml file fixed it
Also the provided repo is not minimal and doesn't include a server app that I can use to debug the behavior.
True, it's not minimal (but it 's pretty small). I don't understand what you mean by "server app". Don't you use https://webhook.site for such things?