Mihail Zheludev
Mihail Zheludev

Reputation: 166

Firefox Push API - AbortError: Error retrieving push subscription

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.

Upvotes: 7

Views: 3527

Answers (3)

Shishir Arora
Shishir Arora

Reputation: 5923

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.

Upvotes: 0

Michael
Michael

Reputation: 321

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).

Upvotes: 3

Marco Castelluccio
Marco Castelluccio

Reputation: 10782

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);
  });
});

Upvotes: 1

Related Questions