MatthieuLemoine / electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
194 stars 69 forks source link

Receiving notifications on a destroyed window causes exception #40

Closed codeminic closed 5 years ago

codeminic commented 5 years ago

So cool that you brought push notifications to electron! First of all, thanks for that!

Sadly, im facing the following issue when using your library: When receiving a notification on a window that has been closed (but the app instance itself is still alive), incoming notifications are causing exceptions, probably because electron-push-receiver tries to call some method on the web contents object that has been destroyed.

image

Is there a way around this, maybe something like a 'teardownPushReceiver' method?

Just let me know if you need some code to repro this behavior.

achou11 commented 5 years ago

@codeminic did you happen to find a workaround for this issue?

codeminic commented 5 years ago

Yes, but a really poor one. I copied the relevant code from this project and surrounded the crashing parts with try-catch clauses.

pedrobertao commented 5 years ago

Anyone knows a solution to do this ? It's happening sporadically in my project

MatthieuLemoine commented 5 years ago

Fixed in https://github.com/MatthieuLemoine/electron-push-receiver/releases/tag/v2.1.3

danieltigse commented 4 years ago

Does anybody still have the same error? I still have it