Firefox Push API - AbortError: Error retrieving push subscription

3.1k Views Asked by At

I'm using Firefox Nightly of 46.0a1 version (there is only 42v. for OS X, and Push API requires 43v).

And I'm getting this error:

DOMException [AbortError: "Error retrieving push subscription"
code: 20
nsresult: 0x80530014]

Here is snippet where this error in thrown:

navigator.serviceWorker.ready.then(function (serviceWorkerRegistration) {

    serviceWorkerRegistration.pushManager.subscribe()
        .then(function (subscription) {
            endpoint = subscription.endpoint;
            console.log('subscription endpoint: ', subscription.endpoint);
            subscribeOnServer();
        })
        .catch(function (e) {

            // here that error is raised

            errorNotification.innerHTML = 'Unable to subscribe to push';
        }
    });
});

In Chrome this place doesn't throw anything and I get subscription with a properly endpoint.

3

There are 3 best solutions below

0
On

It doesn't throw for me.

There was a syntax error in your snippet, but I guess that wasn't the issue (otherwise it would have failed in Chrome as well).

Here's the snippet I've used:

navigator.serviceWorker.ready
.then(function(serviceWorkerRegistration) {
  console.log('asd');
  serviceWorkerRegistration.pushManager.subscribe()
  .then(function(subscription) {
    endpoint = subscription.endpoint;
    console.log('subscription endpoint: ', subscription.endpoint);
  })
  .catch(function(e) {
    console.log(e);
  });
});
0
On

I have recently found that this error may rise if your browser is behind a proxy which does not support web sockets (push service uses web sockets internally).

0
On

I got this error when my service-worker had errors(tried to access non existant store in indexedDb) and so even though it installed but push notifications were not getting subscribed with above error.