Skip to content

Capturing Exception from Service Worker #1123

@coluccini

Description

@coluccini

I'm trying to track exceptions happening inside a service worker to Sentry. I have a very basic setting and everything seams to be fine, except that the error are never sent (or even tried to be send to sentry).
The code looks something like this:

self.importScripts('https://cdn.ravenjs.com/3.19.1/raven.min.js');
Raven.config('sentryPublicKey').install();

self.addEventListener('install', function(event) {
  try {
    // some actions
  } catch (err) {
    console.log(Raven.isSetup());
    Raven.captureException(err);
  }
});

The console.log(Raven.isSetup()); line always print true, so Raven should be correctly set up at this point. And the line Raven.captureException(err); doesn't show any kind of error, but it doesn't do anything either. There's something that makes sentry not being able to run inside a service worker? Some one knows if there is a way to achieve this?
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions