Skip to content

Service worker doesn't store manifest from remote cdn #9609

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

Closed
jason-dahl opened this issue Feb 12, 2018 · 4 comments
Closed

Service worker doesn't store manifest from remote cdn #9609

jason-dahl opened this issue Feb 12, 2018 · 4 comments
Labels

Comments

@jason-dahl
Copy link

jason-dahl commented Feb 12, 2018

The service worker won't store a remotely hosted manifest.json, event though the request to the manifest results in a 200, and you can read the response in the dev console.

Versions

@angular/cdk: 5.2.0
@angular/cli: 1.6.8
@angular/flex-layout: 2.0.0-beta.10-4905443
@angular/material: 5.2.0
@angular/service-worker: 5.2.4
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.7.1
webpack-bundle-analyzer: 2.10.0
webpack: 3.10.0

Repro steps

Set the manifests href in your index.html to a CDN instead of something local. Run the app and you'll see in the network tab of the chrome dev console that your service worker is installed, the request to the manifest succeeds, but the manifest isn't stored.

Observed behavior

customer_list

The applications tab just says "no manifest detected"

Desired behavior

If I have a manifest's href pointing to /manifest.json (local to the app), the service worker picks it up and works as expected.

Why am I doing this?

This might seem like an unusual case, but we need remote manifests due to our customers needing some things customized (ie, icons), so we'll need different manifests depending on which customer is using our app.

My issue may be related to this: angular/angular#20405.

@jason-dahl
Copy link
Author

I think this may be the issue. When registering the service worker with the service worker module, it doesn't take angular-cli's deployUrl into account:

https://github.com/angular/angular/blob/master/packages/service-worker/src/module.ts#L76-L97

And the generated service worker looks for a manifest local to where it (the service worker) is:
https://github.com/angular/angular/blob/master/packages/service-worker/worker/src/driver.ts#L613

@jason-dahl
Copy link
Author

Just in case anyone stumbles upon this, it's looking like a duplicate of:

#9753

@alan-agius4
Copy link
Collaborator

Duplicate of #12322.

@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants