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.
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);
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With