firebase / firebase/firebase-js-sdk
Using onBackgroundMessage on edge display a notification that my chrome extension is running the background
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### 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:
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:
```javascript
onBackgroundMessage(messaging, handleMessage);
```
i've managed to delay the notification when using it like this:
```javascript
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:
```javascript
onBackgroundMessage(messaging, (payload: any) => {
console.log("payload", payload);
});
```
4. load the extension to edge
5. see that when you send the first data message you get the same notification
Contributor guide
Assessment
This issue has not been assessed yet.