bugsnag-js icon indicating copy to clipboard operation
bugsnag-js copied to clipboard

modify bugsnag-js to be imported in a service worker to report errors occurred in it

Open etarancon opened this issue 6 years ago • 10 comments

Expected behavior

The expected behavior is bugsnag-js being able to be imported inside a service worker and catch errors occurred in it without having to listen the onerror event from your app.

Observed behavior

Currently the context of bugsnag-js is window so it cant be imported in a service worker

Version

4.6.3

etarancon avatar May 29 '18 14:05 etarancon

Hi @etarancon, thanks for reporting this and thanks even more for supplying a PR to fix it! It looks like the PR will need some tweaks – unfortunately timing-wise it landed around the same time we pushed an overhaul to the end-to-end tests. I'm happy to take things from here, but there'll probably be a bit of a delay before we get to it.

bengourley avatar Jun 04 '18 14:06 bengourley

Did you run into any of the problems relating to web workers (#170, #172)? Additionally support for service workers begs the question around storing error reports while offline and sending them when the device comes online, which we don't have support for yet (#117).

bengourley avatar Jun 04 '18 14:06 bengourley

@bengourley any update on this issue? After several reading it seems the best way to catch SW errors is from inside the SW https://stackoverflow.com/questions/37736322/how-does-global-error-handling-work-in-service-workers Would be possible to have a plugin that offers this functionality?

Zizzamia avatar Apr 17 '20 22:04 Zizzamia

Hey @Zizzamia, we still have this feature on our backlog as something we hope to look into in the future.

xljones avatar Apr 24 '20 15:04 xljones

Thank you for the reply! @xander-jones could be possible to have an idea when those features are planned to be worked on? The initial issue was open 23 months ago. Just looking to know if I should wait 1~2 more months or come out with a custom solution.

Zizzamia avatar Apr 24 '20 19:04 Zizzamia

Hi @Zizzamia

This isn't an immediate priority for Bugsnag so we can't give an accurate ETA, but I'd say it's unlikely to be worked on during the next 3 months.

mattdyoung avatar Apr 29 '20 22:04 mattdyoung

Google drives Manifest V3 adoption (https://developer.chrome.com/docs/extensions/mv3/intro/) in all chrome extensions. And other browsers started to do so as well. And there, service worker will be mandatory for the background process.

Do you have any plan to support the service worker at this point? Any browser extension that uses Bugsnag soon will stop working in manifest v3 regime.

ohpyupi avatar May 04 '22 23:05 ohpyupi

Hi @ohpyupi, thanks for raising this. We're aware that Chrome and Edge have plans to introduce strict enforcement on service worker adoption in Jan 2023. We're planning to add support for service workers before that comes into effect, and will update this issue when that is implemented.

yousif-bugsnag avatar May 17 '22 09:05 yousif-bugsnag

Any update on this? @yousif-bugsnag

sghsri avatar Aug 23 '22 16:08 sghsri

Hi @sghsri, we're still planning to add support before the enforcement comes into effect in January but I'm afraid I don't have any further updates at this time.

yousif-bugsnag avatar Sep 02 '22 08:09 yousif-bugsnag

I ran into this issue as well. One note is that enforcement is in effect in January, but as of today all new extensions must be manifest v3. So any new app will not be able to Bugsnag in the service worker.

sb8244 avatar Nov 19 '22 21:11 sb8244

Hi @sb8244 - no further updates on this since Yousif's comments above, we'll continue to update this thread as appropriate 👍

luke-belton avatar Nov 21 '22 09:11 luke-belton

Hi all! We have just published a beta version of bugsnag for web workers and service workers in order to facilitate development of web and service workers and also browser extensions with manifest v3. It’s a basic implementation which we will be adding to in future, but will enable you to send errors to Bugsnag and catch unhandled errors (with some caveats for browser extensions on Chrome).

gingerbenw avatar Dec 15 '22 17:12 gingerbenw

Our web worker and service worker package is now fully released. See our docs for more details and I'll close this issue.

gareththackeray avatar Feb 09 '23 13:02 gareththackeray