Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PushManager subscription promise never fulfill nor reject

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.

like image 865
Arturo Avatar asked Mar 03 '16 14:03

Arturo


3 Answers

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.

like image 109
Miguel Garcia Avatar answered Nov 14 '22 07:11

Miguel Garcia


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

like image 1
Arturo Avatar answered Nov 14 '22 06:11

Arturo


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.

like image 1
Alex Walker Avatar answered Nov 14 '22 07:11

Alex Walker