Description
Which @angular/* package(s) are the source of the bug?
service-worker
Is this a regression?
Yes
Description
Hey,
I'm trying to determine if new update is available, but for some reason, in following code:
constructor(appRef: ApplicationRef, private swUpdate: SwUpdate) {
if (this.swUpdate.isEnabled) {
const appIsStable$ = appRef.isStable.pipe(first((isStable) => isStable === true));
const intervalObs$ = interval(30* 1000);
const stableIntervalObs$ = concat(appIsStable$, intervalObs$);
stableIntervalObs$.subscribe(() => {
swUpdate.checkForUpdate().then(response => {
// This is never hit
});
});
}
}
The swUpdate.checkForUpdate is never resolved. Strangely, this happens only in production mode. It works perfectly fine when tested locally with service worker & HTTP server. It should return true / false depending on whether a new update is available, but it never returns anything. Really no idea why it works like a charm locally, but not on production. (I've tried clearing cache, removing service worker, anonymous window and all the usual stuff)
In network tab I can see that the ngsw.json?ngsw-cache-bust=0.0010572762505560718 is being hit as expected (every 30 sec in my case), however the timestamp is the same for all requests.
Can you guys think of any reason the checkForUpdate would never resolve on production? Is there something I can test / check?
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in
Angular 13.0.0
Anything else?
No response

