11

I am currently facing an issue with some Chrome (Chromium) version where the PushManager.subscribe promise from a ServiceWorker stays in a pending state.

The code itself is pretty simple :

return serviceWorkerRegistration.pushManager.subscribe({
    userVisibleOnly: true
  });

I have a valid and accessible JSON manifest, providing the GCM Sender ID. I also tried different implementations, as described in this post, but the result is still the same.

The subscription part works well with every 47+ version, the issue appears with older releases. (I'm using Chromium continuous builds to test the different major versions).

Also note that, while using Chromium 46 (and below) on Ubuntu, the promise rejects after 15 minutes with an Internal Server Error.

Community
  • 1
  • 1
Arturo
  • 213
  • 1
  • 3
  • 12
  • Do you need to support such old versions of Chrome? The current stable version is 49. Maybe something has changed in the way Chrome talks with GCM and older versions are no longer supported? – Marco Castelluccio Mar 03 '16 at 15:19
  • Indeed, as Chrome has an auto-update feature, a difference of 2 or 3 versions, users with older releases are marginal. Although, this is a global figure, maybe some in some location/country the update tends to arrive lately. Is the lack of support from GCM come from the Chromium builds I use, or the "older-stable" Chrome releases ? – Arturo Mar 03 '16 at 18:17
  • I'm not sure, I run tests for my web-push library (https://github.com/marco-c/web-push) both in Firefox and Chromium and they work, but in the tests I'm always using the latest versions. – Marco Castelluccio Mar 03 '16 at 21:31

7 Answers7

1

The problem is with userVisibleOnly: true as a parameter.

This was only introduced in chrome 47. Before that you need to pass it as a manifest parameter. https://johnme-gcm.appspot.com/manifest.json is a good example to follow.

Miguel Garcia
  • 1,029
  • 5
  • 14
  • I have a **gcm_user_visible_only** set to true in the manifest. But if I remove the parameter from the `subscribe` method, I've got an error _Chrome currently only supports the Push API for subscriptions that will result in user-visible messages [...]_ I think your example was introduce in [Chrome44+](http://stackoverflow.com/questions/31286265/gcm-registration-id-in-service-worker-in-push-notification-for-chrome#comment-50592719) – Arturo Mar 04 '16 at 10:03
  • still not working. not returning or rejecting promise! – mythicalcoder Jul 12 '19 at 16:17
1

It appears that the Chromium Team was working on it. If I'm not mistaken, a fix will be release on Chrome 55

Arturo
  • 213
  • 1
  • 3
  • 12
1

I had the same issue while using a corporate proxy. Because there's no Internet connection, the subscription cannot be established and the Promise never resolves.

Alex Walker
  • 2,337
  • 1
  • 17
  • 32
0

This issue is reproducible on chrome 55.0.2883.87 on Windows 7. The subscribe promise is neither resolving nor rejecting. But this is happening only on one machine with the combination mentioned

0

I had the same issue in Chrome 67, and a browser restart has fixed it.

user828878
  • 398
  • 4
  • 8
0

Update and restart my google chrome was resolved for me

Lsb
  • 9
  • 3
0

When you subscribe to pushManager, a req is sent to the browsers push service for a subscription endpoint. If its not fulfilling or rejecting its likely because theres an issue establishing a connection to your browsers push service.

Spankied
  • 1,626
  • 13
  • 21