tauri: [bug] Register deep-link with single instance not working.
Describe the bug
I am using create tauri app to test deep link, I am expect to have a feature that open tauri-test://* url and read the content with the running app, and the app could log the content from the console. But the system doesn’t recognize the link
I use useEffect(() => { onOpenUrl((urls) => { setGreetMsg(urls[0]); });
isRegistered("tauri-test").then((registered) => {
console.log(registered);
if (!registered) {
setGreetMsg("Not registered");
}
});
}, []);
to see if the link has been registered but encountering
Reproduction
https://github.com/panwangwin/tauri-feature-test I have upload this repo to reproduce this bug.
Expected behavior
Could open tauri-test://* URL and can see url logged at console
Full tauri info output
> tauri-test@0.1.0 tauri
> tauri info
[✔] Environment
- OS: Windows 10.0.26100 x86_64 (X64)
✔ WebView2: 133.0.3065.69
✔ MSVC:
- Visual Studio Build Tools 2019
- Visual Studio Enterprise 2022
✔ rustc: 1.84.1 (e71f9a9a9 2025-01-27)
✔ cargo: 1.84.1 (66221abde 2024-11-19)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 18.19.0
- yarn: 1.22.19
- npm: 10.2.3
[-] Packages
- tauri 🦀: 2.2.5
- tauri-build 🦀: 2.0.5
- wry 🦀: 0.48.1
- tao 🦀: 0.31.1
- @tauri-apps/api : 2.2.0
- @tauri-apps/cli : 2.2.7
[-] Plugins
- tauri-plugin-deep-link 🦀: 2.2.0
- @tauri-apps/plugin-deep-link : 2.2.0
- tauri-plugin-single-instance 🦀: 2.2.1
- @tauri-apps/plugin-single-instance : not installed!
- tauri-plugin-opener 🦀: 2.2.5
- @tauri-apps/plugin-opener : 2.2.5
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
PS D:\src\Playground\tauri-test> yarn run tauri dev
yarn run v1.22.19
$ tauri dev
Running BeforeDevCommand (`yarn dev`)
$ vite
VITE v6.1.0 ready in 439 ms
➜ Local: http://localhost:1420/
Running DevCommand (`cargo run --no-default-features --color always --`)
Info Watching D:\src\Playground\tauri-test\src-tauri for changes...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.49s
Running `target\debug\tauri-test.exe`
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
It seems like the link triggers another instance, and the single instance plugin closed it immediately.
I think I could use app.emit here and listen to this event at js side as a work around. But is this the expect result?
same. i simply cloned the repo you provided on a windows 11 system and it just worked x)
only on windows and linux btw
I am facing the same issue here recently. And I found that actually it can be registered using
But it does not work when the scheme is in tauri.conf.json
isRegistered returning false makes sense I think. iirc it compares the file path of the registered app with the one currently running.
Not receiving the callback via the single instance when tauri dev is running is a bit weird though but maybe I forgot something. I’ll try to take a quick look when I’m back home.