Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

231
Visualizações
pushManager.subscribe() randomly fails with AbortError

This is happening on Chrome only (application doesn't support any other browsers for now) and on recent versions.

I can't reproduce this issue, but it regularly shows up in our monitoring dashboard for random users.

Error message: "AbortError: Registration failed - push service error"

The following code block runs on page load:

const currentNotificationsPermission = await navigator.permissions.query({ name: 'notifications' });
currentNotificationsPermission.onchange = function onchange() {
  // Update the internal state, this can happen after user interaction (clicking a "Allow notifications" button)
};

This runs on pageload (when the internal state is granted), or whenever the internal state changes to granted after a user gesture:

navigator.serviceWorker.register('/serviceworker.js', { scope: '/myScope' });
navigator.serviceWorker.ready.then((registration) => {
  const subscribeOptions = {
    userVisibleOnly: true,
    applicationServerKey: 'myKey',
  };

  return registration.pushManager.subscribe(subscribeOptions);
}).then((pushSubscription) => {
  // Send pushSubscription to server, doesn't run in case of AbortError
}).catch((err) => { 
  console.log(err); // AbortError, randomly
});
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I guess you can't check chrome://gcm-internals/ if you can't reproduce the problem.

One possibility is that some of your users may have Chrome settings or add-ons that prevent the use of GCM, but the error message is not quite in line with that.

My guess is that this is a case of TOO_MANY_REGISTRATIONS where a device has too many individual registrations with FCM. It might be that some of your users have too many client apps, or one of their client apps may be registering itself over and over again, resulting in many registrations.

about 4 years ago · Juan Pablo Isaza Relatório

0

According to the Push API spec, this error can happen in a few ways for the subscribe method: https://w3c.github.io/push-api/#dom-pushmanager

  1. If there was an error retrieving the push subscription associated with the Service Worker (returns AbortError).
  2. If there was an error setting subscription as the result of running the create a push subscription steps given options (returns AbortError).

These are both internal processes to the browser as they involve interacting with the internal Push Service.

As noted here, the push service is not something available to developers: https://developers.google.com/web/fundamentals/push-notifications/how-push-works#who_and_what_is_the_push_service.

There have been some historical errors due to this service for Chrome. I can see some posts for this as far back as Chrome 59.

For now you might want to protect this line of code with a try/catch and log details where you can access them registration.pushManager.subscribe(subscribeOptions);

It might simply need a retry when this fails or it's somehow running into issues due to an older version of Chrome.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda