#Troubles with plugin-os api

8 messages · Page 1 of 1 (latest)

vestal bolt
#

Recently in my application i needed to know to plaftform where it is runing on, so i can enable/disable some features, but after installing both crate and node module i get an error, much like this one on this thread https://github.com/tauri-apps/plugins-workspace/issues/719
I see comments saying in mac OS works fine (im on windows) and i've also seen this code

impl InitJavascript<'_> {
    fn new() -> Self {
        Self {
            #[cfg(windows)]
            eol: "\r\n",
            #[cfg(not(windows))]
            eol: "\n",
            os_type: crate::type_().to_string(),
            platform: crate::platform(),
            family: crate::family(),
            version: crate::version().to_string(),
            arch: crate::arch(),
            exe_extension: crate::exe_extension(),
        }
    }
}

Wich seems to let expose thse on windows? But in init.js of the os-plugin it tries to define Object.defineProperty(window, '__TAURI_OS_PLUGIN_INTERNALS__'). But this object is not defined in the browser window at all. Only indow._TAURI_INTERNALS is...
Can anyne help wwith this?
Thnx in advance

GitHub

Describe the bug I did the project as shown in the docs, but this error is appearing in the browser console. Reproduction This happened when I added to the project // This is the part where the plu...

heady perch
#

can you share the output of the tauri info command please?

vestal bolt
#

Sure!

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 134.0.3124.93
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 23.6.0
    - npm: 10.9.2
    - bun: 1.1.36
    - deno: deno 2.2.8

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - tauri-cli 🦀: 2.0.4
    - @tauri-apps/api : 2.4.1
    - @tauri-apps/cli : 2.0.5 (outdated, latest: 2.4.1)

[-] Plugins
    - tauri-plugin-os 🦀: 2.2.1
    - @tauri-apps/plugin-os : 2.2.1
    - tauri-plugin-http 🦀: 2.0.3
    - @tauri-apps/plugin-http : 2.4.3
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.2.1
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.2.1
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.2.1
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.1.0 (outdated, latest: 2.2.0)
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.2.1
    - tauri-plugin-updater 🦀: 2.0.2
    - @tauri-apps/plugin-updater : 2.7.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite
heady perch
#

thanks. do you have something like this in your lib.rs file? ```rs
.plugin(tauri_plugin_os::init())

vestal bolt
#

I initialzed every plugin that i need 🙂

heady perch
#

can you try a fresh create-tauri-app where you only run tauri add os ?

vestal bolt
#

Ok i will do that. Now, i dunno why, the webview also hangs on the awaiting of body.json() on web requests. The rust backend correctly fetches, and returns to the window. But then the javasripts just gets stuck awaiting the body.json(), and i cant pinpoint exactly what happened. I'll make a new project and start passing things there to see if i can find the issue. Ill keep you posted.

Thnx very much for the help!