Skip to content
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

Angular service worker state (/ngsw/state) doesn't work if context is not / #30505

Closed
autozoom opened this issue May 16, 2019 · 4 comments
Closed
Labels
area: service-worker Issues related to the @angular/service-worker package help wanted An issue that is suitable for a community contributor (based on its complexity/scope). state: confirmed type: bug/fix
Milestone

Comments

@autozoom
Copy link

autozoom commented May 16, 2019

🐞 bug report

Affected Package

@angular/pwa
@angular/service-worker

Description

Service worker state is not viewable if the app context is not /

🔬 Minimal Reproduction

For example:

🌍 Your Environment

Angular Version:


Angular CLI: 7.3.8
Node: 10.15.0
OS: win32 x64
Angular: 7.2.12
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.12.4
@angular-devkit/build-angular      0.12.4
@angular-devkit/build-ng-packagr   0.12.4
@angular-devkit/build-optimizer    0.12.4
@angular-devkit/build-webpack      0.12.4
@angular-devkit/core               7.2.4
@angular-devkit/schematics         7.3.8
@angular/cdk                       7.3.7
@angular/cli                       7.3.8
@angular/material                  7.3.7
@angular/pwa                       0.12.4
@angular/service-worker            7.2.15
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.2.4
@schematics/angular                7.3.8
@schematics/update                 0.13.8
ng-packagr                         4.7.1
rxjs                               6.4.0
typescript                         3.2.4
webpack                            4.28.4

this comment to another issue is relevant: #30351 (comment)

@gkalpak
Copy link
Member

gkalpak commented May 16, 2019

This is related to #25055. The code posted in #25055 (comment) should fix this as well (see L1797 and L1882 in the updated code).

@autozoom, if you (or anyone else) is interested in working on this, I'd be happy to help.
(You would basically take the fix from #25055 (comment), put it in a PR and add tests.)

@gkalpak gkalpak added area: service-worker Issues related to the @angular/service-worker package type: bug/fix labels May 16, 2019
@ngbot ngbot bot added this to the needsTriage milestone May 16, 2019
@gkalpak gkalpak added the help wanted An issue that is suitable for a community contributor (based on its complexity/scope). label May 16, 2019
mattlewis92 added a commit to mattlewis92/angular that referenced this issue Jun 16, 2019
mattlewis92 added a commit to mattlewis92/angular that referenced this issue Jul 1, 2019
@Jun711
Copy link
Contributor

Jun711 commented Jan 20, 2020

@autozoom
Did you get the following error when you tried to access ngsw/state when building PWA using --base-href="/myfolder/"

core.js:15713 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'ngsw/state'
Error: Cannot match any routes. URL Segment: 'ngsw/state'

#29944

@gkalpak
Do you have any update regarding this issue?

@gkalpak
Copy link
Member

gkalpak commented Jan 21, 2020

@Jun711, not much of an update, I'm afraid.

Someone started a PR (#31082) based on the code I posted in #25055 (comment) (which would solve the issue), but couldn't see it through, then a bunch of people offered to pick it up, but nobody did 😁

If nobody beats me to it, I will pick it up at some point (after Ivy is released) 🤷‍♂

sonukapoor added a commit to sonukapoor/angular that referenced this issue Jun 15, 2020
sonukapoor added a commit to sonukapoor/angular that referenced this issue Jun 15, 2020
gkalpak pushed a commit to gkalpak/angular that referenced this issue Jun 21, 2020
gkalpak pushed a commit to gkalpak/angular that referenced this issue Jun 21, 2020
gkalpak added a commit to gkalpak/angular that referenced this issue Jul 3, 2020
…scope

The Angular ServiceWorker can serve requests to a special virtual path,
`ngsw/state`, showing [information about its internal state][1], which
can be useful for debugging.

Previously, this would only work if the ServiceWorker's [scope][2] was
the root directory (`/`). Otherwise, (e.g. when building the app with
`--baseHref=/some/path/`), the ServiceWorker would fail to detect a
request to `/some/path/ngsw/state` as matching `ngsw/state` and would
not serve it with the debugging information.

This commit fixes it by ensuring that the ServiceWorker's scope is taken
into account when detecting a request to `ngsw/state`.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information
[2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope

Fixes angular#30505
gkalpak added a commit to gkalpak/angular that referenced this issue Jul 5, 2020
…scope

The Angular ServiceWorker can serve requests to a special virtual path,
`ngsw/state`, showing [information about its internal state][1], which
can be useful for debugging.

Previously, this would only work if the ServiceWorker's [scope][2] was
the root directory (`/`). Otherwise, (e.g. when building the app with
`--baseHref=/some/path/`), the ServiceWorker would fail to detect a
request to `/some/path/ngsw/state` as matching `ngsw/state` and would
not serve it with the debugging information.

This commit fixes it by ensuring that the ServiceWorker's scope is taken
into account when detecting a request to `ngsw/state`.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information
[2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope

Fixes angular#30505
gkalpak added a commit to gkalpak/angular that referenced this issue Jul 6, 2020
…scope

The Angular ServiceWorker can serve requests to a special virtual path,
`ngsw/state`, showing [information about its internal state][1], which
can be useful for debugging.

Previously, this would only work if the ServiceWorker's [scope][2] was
the root directory (`/`). Otherwise, (e.g. when building the app with
`--baseHref=/some/path/`), the ServiceWorker would fail to detect a
request to `/some/path/ngsw/state` as matching `ngsw/state` and would
not serve it with the debugging information.

This commit fixes it by ensuring that the ServiceWorker's scope is taken
into account when detecting a request to `ngsw/state`.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information
[2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope

Fixes angular#30505
@atscott atscott closed this as completed in 2156bee Jul 9, 2020
atscott pushed a commit that referenced this issue Jul 9, 2020
…scope (#37922)

The Angular ServiceWorker can serve requests to a special virtual path,
`ngsw/state`, showing [information about its internal state][1], which
can be useful for debugging.

Previously, this would only work if the ServiceWorker's [scope][2] was
the root directory (`/`). Otherwise, (e.g. when building the app with
`--baseHref=/some/path/`), the ServiceWorker would fail to detect a
request to `/some/path/ngsw/state` as matching `ngsw/state` and would
not serve it with the debugging information.

This commit fixes it by ensuring that the ServiceWorker's scope is taken
into account when detecting a request to `ngsw/state`.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information
[2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope

Fixes #30505

PR Close #37922
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 9, 2020
profanis pushed a commit to profanis/angular that referenced this issue Sep 5, 2020
…scope (angular#37922)

The Angular ServiceWorker can serve requests to a special virtual path,
`ngsw/state`, showing [information about its internal state][1], which
can be useful for debugging.

Previously, this would only work if the ServiceWorker's [scope][2] was
the root directory (`/`). Otherwise, (e.g. when building the app with
`--baseHref=/some/path/`), the ServiceWorker would fail to detect a
request to `/some/path/ngsw/state` as matching `ngsw/state` and would
not serve it with the debugging information.

This commit fixes it by ensuring that the ServiceWorker's scope is taken
into account when detecting a request to `ngsw/state`.

[1]: https://angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information
[2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope

Fixes angular#30505

PR Close angular#37922
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: service-worker Issues related to the @angular/service-worker package help wanted An issue that is suitable for a community contributor (based on its complexity/scope). state: confirmed type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants