New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service worker updates do not work on latest chrome (Chrome 66.0.3359.117 ) #23526

Closed
MichalK6677 opened this Issue Apr 24, 2018 · 14 comments

Comments

Projects
None yet
9 participants
@MichalK6677

MichalK6677 commented Apr 24, 2018

I generated empty angular application via ng new appName --service-worker and implemented swUpdate:


export class AppComponent {
  title = 'test';
  
  constructor(private swUpdate: SwUpdate) {
    }

    ngOnInit() {

        if (this.swUpdate.isEnabled) {

            this.swUpdate.available.subscribe(() => {
				console.log("New version available.");
                if(confirm("New version available. Load New Version?")) {

                    window.location.reload();
                }
            });
        }        
    }
}

2018-04-24_1901

When service worker detects new version and I reload a page (via confim ok of F5) then I see an exception in console:
2018-04-24_1852
and chrome displayes "This page can't be reached". It works if I refresh via ctrl+F5. Refresh via F5 work again after clearing data via dev. tools -> application tab.
It worked fine on older chrome 65.0.3325.181. It stopped working imediately I updated chrome. It is tested on 2 independent computers.

Current behavior

All sites in application displays "This page can't be reached" after Chrome update to latest 66.0.3359.117 version when service worker detects new version.

Expected behavior

Application should load latest version with refresh page.

Minimal reproduction of the problem with instructions

  1. create new angular app with service worker via cli
  2. implement swUpdate
  3. test on chrome 66.0.3359.117

Browser:

  • Chrome (desktop) version 66.0.3359.117
@gkalpak

This comment has been minimized.

Show comment
Hide comment
@gkalpak

gkalpak Apr 24, 2018

Member

This is a duplicate of #23296. It sounds like a Chrome bug (see #23296 (comment)).
Could be related to https://bugs.chromium.org/p/chromium/issues/detail?id=832105.

There is also a chance it has been fixed by #22883. Can you try with the latest 6.x version (currently 6.0.0-rc.5)?

Member

gkalpak commented Apr 24, 2018

This is a duplicate of #23296. It sounds like a Chrome bug (see #23296 (comment)).
Could be related to https://bugs.chromium.org/p/chromium/issues/detail?id=832105.

There is also a chance it has been fixed by #22883. Can you try with the latest 6.x version (currently 6.0.0-rc.5)?

@MichalK6677

This comment has been minimized.

Show comment
Hide comment
@MichalK6677

MichalK6677 Apr 24, 2018

I've tried the latest 6.x version. It seems like the issue is still present.

MichalK6677 commented Apr 24, 2018

I've tried the latest 6.x version. It seems like the issue is still present.

@gkalpak

This comment has been minimized.

Show comment
Hide comment
@gkalpak

gkalpak Apr 24, 2018

Member

Wait. Are you saying that your GMail login status makes a difference in how the ServiceWorker works in an Angular app?

Member

gkalpak commented Apr 24, 2018

Wait. Are you saying that your GMail login status makes a difference in how the ServiceWorker works in an Angular app?

@MichalK6677

This comment has been minimized.

Show comment
Hide comment
@MichalK6677

MichalK6677 Apr 24, 2018

No. Sorry my mistake in testing. It does not matter on gmail status.

MichalK6677 commented Apr 24, 2018

No. Sorry my mistake in testing. It does not matter on gmail status.

@gkalpak

This comment has been minimized.

Show comment
Hide comment
@gkalpak

gkalpak Apr 24, 2018

Member

OK, I'll try to investigate this week and see if we can reliably work around the issue (assuming it is indeed a Chrome issue).

Member

gkalpak commented Apr 24, 2018

OK, I'll try to investigate this week and see if we can reliably work around the issue (assuming it is indeed a Chrome issue).

@zh99998

This comment has been minimized.

Show comment
Hide comment
@zh99998

zh99998 Apr 25, 2018

I got into same problem

2018-04-25 11 54 38

chrome says clientId is "" (empty string), so clientId !== null check passed but this.scope.clients.get(clientId) got undefined.

a simple work-around is to check other falsy value. if (clientId) { ... }

zh99998 commented Apr 25, 2018

I got into same problem

2018-04-25 11 54 38

chrome says clientId is "" (empty string), so clientId !== null check passed but this.scope.clients.get(clientId) got undefined.

a simple work-around is to check other falsy value. if (clientId) { ... }

@NathofGod

This comment has been minimized.

Show comment
Hide comment
@NathofGod

NathofGod Apr 25, 2018

I'm getting the same issue which is stopping my site being accessible

The problem is client.id in the following area

image

My issue happens on my live site here https://spark.ricoh.co.uk/welcome when updating

NathofGod commented Apr 25, 2018

I'm getting the same issue which is stopping my site being accessible

The problem is client.id in the following area

image

My issue happens on my live site here https://spark.ricoh.co.uk/welcome when updating

@gkalpak gkalpak modified the milestones: Backlog, v6.0 Apr 30, 2018

gkalpak added a commit to gkalpak/angular that referenced this issue Apr 30, 2018

fix(service-worker): correctly handle requests with empty `clientId`
Requests from clients that are not assigned a client ID may produce
`fetch` events with `null` or empty (`''`) `clientId`. Previously, only
`null` values were handled correctly, but empty strings are also valid
(see for example [here][1] and [there][2]).
This commit fixes it by interpreting _all_ falsy `clientId` values the
same (no client ID assigned).

Related Chromium issue/discussion:
https://bugs.chromium.org/p/chromium/issues/detail?id=832105

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface

Fixes #23526

gkalpak added a commit to gkalpak/angular that referenced this issue Apr 30, 2018

fix(service-worker): correctly handle requests with empty `clientId`
Requests from clients that are not assigned a client ID may produce
`fetch` events with `null` or empty (`''`) `clientId`.

Previously, only `null` values were handled correctly, but empty strings
are also valid (see for example [here][1] and [there][2]).
This commit fixes it by interpreting _all_ falsy `clientId` values the
same (no client ID assigned).

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

gkalpak added a commit to gkalpak/angular that referenced this issue Apr 30, 2018

fix(service-worker): correctly handle requests with empty `clientId`
Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

gkalpak added a commit to gkalpak/angular that referenced this issue Apr 30, 2018

fix(service-worker): correctly handle requests with empty `clientId`
Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526
@patrickmichalina

This comment has been minimized.

Show comment
Hide comment
@patrickmichalina

patrickmichalina May 2, 2018

Ahh same issue here!

patrickmichalina commented May 2, 2018

Ahh same issue here!

@alexcarrasco93

This comment has been minimized.

Show comment
Hide comment
@alexcarrasco93

alexcarrasco93 May 3, 2018

Same issue here. I'm just developing so I have a breakpoint at the line it is supposed to be defined and I just define it with the console meanwhile. Hope this bug is going to be fixed quickly.

alexcarrasco93 commented May 3, 2018

Same issue here. I'm just developing so I have a breakpoint at the line it is supposed to be defined and I just define it with the console meanwhile. Hope this bug is going to be fixed quickly.

@meowhunter

This comment has been minimized.

Show comment
Hide comment
@meowhunter

meowhunter May 7, 2018

Same issue guys,
image

Got the same on service worker update.
Does anybody have workaround on that while angular team working on fix?

meowhunter commented May 7, 2018

Same issue guys,
image

Got the same on service worker update.
Does anybody have workaround on that while angular team working on fix?

@webmaxru

This comment has been minimized.

Show comment
Hide comment
@webmaxru

webmaxru May 7, 2018

Member

Hi @meowhunter! Please, confirm that you use the latest (release) version of NGSW. This issue should ne fixed via gkalpak@2ff1be0

Member

webmaxru commented May 7, 2018

Hi @meowhunter! Please, confirm that you use the latest (release) version of NGSW. This issue should ne fixed via gkalpak@2ff1be0

@zh99998

This comment has been minimized.

Show comment
Hide comment
@zh99998

zh99998 May 7, 2018

@webmaxru I have tried latest release but problem still exists.

"dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/cdk": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/material": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/pwa": "^0.6.0",
    "@angular/router": "^6.0.0",
    "@angular/service-worker": "^6.0.0",
    ...
  },

zh99998 commented May 7, 2018

@webmaxru I have tried latest release but problem still exists.

"dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/cdk": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/material": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/pwa": "^0.6.0",
    "@angular/router": "^6.0.0",
    "@angular/service-worker": "^6.0.0",
    ...
  },
@gkalpak

This comment has been minimized.

Show comment
Hide comment
@gkalpak

gkalpak May 9, 2018

Member

This should be fixed by #23625, but it hasn't been merged yet.

Member

gkalpak commented May 9, 2018

This should be fixed by #23625, but it hasn't been merged yet.

@IgorMinar IgorMinar closed this in e0ed59e May 9, 2018

IgorMinar added a commit that referenced this issue May 9, 2018

fix(service-worker): correctly handle requests with empty `clientId` (#…
…23625)

Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

PR Close #23625
@webmaxru

This comment has been minimized.

Show comment
Hide comment
@webmaxru

webmaxru May 11, 2018

Member

Should be fixed in just released 6.0.1 - please check

Member

webmaxru commented May 11, 2018

Should be fixed in just released 6.0.1 - please check

gkalpak added a commit to gkalpak/angular that referenced this issue May 14, 2018

fix(service-worker): correctly handle requests with empty `clientId` (#…
…23625)

Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

PR Close #23625

alxhub added a commit that referenced this issue May 15, 2018

fix(service-worker): correctly handle requests with empty `clientId` (#…
…23625)

Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

PR Close #23625

mashhoodr added a commit to mashhoodr/angular that referenced this issue May 28, 2018

fix(service-worker): correctly handle requests with empty `clientId` (#…
…23625)

Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: https://github.com/w3c/ServiceWorker/blob/4cc72bd0f13359f16cc733d88bed4ea52ee063c0/docs/index.bs#L1392
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

PR Close #23625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment