Firefox Push API - AbortError: error receiving a push subscription

I am using Firefox Nightly version 46.0a1 (only 42v for OS X and 43v for the Push API). And I get this error:

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

Here is a snippet where this throw error is:

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 a subscription with the correct endpoint.

Please, help

+4
source share
1 answer

It does not give up for me.

There was a syntax error in your snippet, but I think this is not a problem (otherwise it would also fail in Chrome).

Here is the snippet I 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);
  });
});
+1
source

Source: https://habr.com/ru/post/1621933/


All Articles