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

Using onBackgroundMessage on edge display a notification that my chrome extension is running the background #8117

Open
aviv-elmakias opened this issue Apr 2, 2024 · 2 comments

Comments

@aviv-elmakias
Copy link

Operating System

Windows 11 (but also happening on macos 14.3.1)

Browser Version

Edge 123.0.2420.65

Firebase SDK Version

10.9.0

Firebase SDK Product:

Messaging

Describe your project's tooling

Chrome extension

Describe the problem

Whenever i send a push message to one of my extension clients, this message pops up:
image

this issue does not reproduce on chrome, and looks like it's specific to the edge browser.
i use this snippet to handle the messages:

  onBackgroundMessage(messaging, handleMessage);

i've managed to delay the notification when using it like this:

self.addEventListener("push", (event) => {
    onBackgroundMessage(messaging, (payload: any) => {
      console.log("payload", payload);
      event.waitUntil(handleMessage(payload));
      event.waitUntil(
        new Promise((resolve, reject) => {
          setTimeout(reject, 10000);
        })
      );
    });
  });

but it still shows it when the timeout is finished.

Steps and code to reproduce issue

  1. create a minimal chrome extension with background.js that import the firebase package. (need to also add the "notifications" permission)
  2. initialize the app just like the firebase example
  3. listen to data messages like this:
    onBackgroundMessage(messaging, (payload: any) => {
      console.log("payload", payload);
    });
  1. load the extension to edge
  2. see that when you send the first data message you get the same notification
@aviv-elmakias aviv-elmakias added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Apr 2, 2024
@jbalidiong jbalidiong added needs-attention and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels Apr 2, 2024
@zwu52
Copy link
Member

zwu52 commented May 8, 2024

you would need to call ShowNotification to prevent this warning. it's WAI to prevent silent push.

@aviv-elmakias
Copy link
Author

@zwu52 so there is no other option to send silent push notifications?
i use it for my chrome extension to send updates, but there is no need to show something to the client about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants