Skip to content

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

Open
@aviv-elmakias

Description

@aviv-elmakias

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions