问题
When trying to install a service worker (Chrome 55), I'm getting this error in the browser console.
Registration failed - could not retrieve the public key
But this is happening only in the browser in one of the devices. In other devices in chrome 55, it's working fine. I'm not able to replicate this issue in other devices with the same chrome version. So I suppose this is not a problem with worker or manifest files. I would be very happy somebody could throw some light on this issue.
回答1:
I got some advice from service worker discuss group regarding this error. Peter who is part of Chromium project says that
"This is the sort of error that fits in the "this should never happen" category. The only situation in which this would happen is when the on-disk GCM Key Store database got corrupted and, for some reason, cannot be recovered."
and Matt pointed me to this : https://cs.chromium.org/chromium/src/content/public/common/push_messaging_status.cc?type=cs&q=%22could+not+retrieve+the+public+key%22&sq=package:chromium&l=49
So this bug happens to be in "should never happen" category. Luckily when I restarted the machine, in which the chrome was throwing this error, the error disappeared and it started working fine.
Read more about this here : https://groups.google.com/a/chromium.org/forum/#!topic/service-worker-discuss/gCFxq4fHPVw
来源:https://stackoverflow.com/questions/41882541/web-push-service-worker-registration-error-registration-failed-could-not-ret