Skip to content

Notification does not works #917

@ghost

Description

Describe the bug
I tried two methods to send a notification:

  1. via js
  showNotification(): void {
    const notification = new Notification('Hi there!');
  }

result: nothing happened: no notificaions and no errors

  1. via rust:
event::listen(String::from("notification"), move |msg| {
        println!("got notification with message '{:?}'", msg);
        let res = Notification::new()
          .title("New message")
          .body("You've got a new message.")
          .show();

        match res {
          Err(e) => {},
          Ok(_) => println!("notification success")
        }
      })

app crashed with errors:

  Finished dev [unoptimized + debuginfo] target(s) in 3.01s
     Running `target\debug\tauri-api-demos.exe`
got notification with message 'Some("notification data")'
thread 'main' panicked at 'failed to call RoInitialize: error -2147417850', C:\Users\tobiastao\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rust
lib/src/rust\src\libstd\macros.rs:16:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\tauri-api-demos.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

 app:spawn Command "cargo" failed with exit code: 3221226505 +0ms

 app:tauri (runner) ⚠️  [FAIL] Cargo CLI has failed +2ms

 app:tauri Shutting down tauri process... +1ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce
Steps to reproduce the behavior:

  1. clone the repo: git@github.com:TobiasTao/tauri-api-demos.git
  2. yarn
  3. yarn fe:dev
  4. yarn be:dev

then click buttons:
image

Platform and Versions (please complete the following information):

[tauri]: running info

Operating System - Windows_NT(10.0.18363) - win32/x64
Microsoft Edge - 44.18362.449.0_neutral__8wekyb3d8bbwe

Node.js environment
  Node.js - 12.18.3
  tauri.js - 0.11.0

Rust environment
  rustc - 1.45.0
  cargo - 1.45.0
  tauri-bundler - 0.9.1

Global packages
  NPM - 6.14.6
  yarn - 1.22.4

App directory structure
/.git
/.idea
/.vscode
/dist
/e2e
/node_modules
/src
/src-tauri

App
  tauri.rs - 0.9.0
  mode - embedded-server
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
  distDir - ../dist/tauri-api-demos
  devPath - http://localhost:4200

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions