Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 548
Mihail Zheludev Avatar asked Dec 28 '15 08:12

Mihail Zheludev


Video Answer


1 Answers

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);
  });
});
like image 121
Marco Castelluccio Avatar answered Oct 05 '22 11:10

Marco Castelluccio