PushManager subscription promise never fulfill nor

2020-06-12 06:00发布

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.

6条回答
成全新的幸福
2楼-- · 2020-06-12 06:20

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

查看更多
淡お忘
3楼-- · 2020-06-12 06:28

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

查看更多
霸刀☆藐视天下
4楼-- · 2020-06-12 06:28

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.

查看更多
Emotional °昔
5楼-- · 2020-06-12 06:32

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

查看更多
做自己的国王
6楼-- · 2020-06-12 06:40

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.

查看更多
狗以群分
7楼-- · 2020-06-12 06:40

Update and restart my google chrome was resolved for me

查看更多
登录 后发表回答