Skip to content

Service worker issue - refused to execute script #9945

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
LanderBeeuwsaert opened this issue Mar 12, 2018 · 2 comments
Closed

Service worker issue - refused to execute script #9945

LanderBeeuwsaert opened this issue Mar 12, 2018 · 2 comments

Comments

@LanderBeeuwsaert
Copy link

Versions

angular: 5.2.8
angular-cli: 6.0.0-beta.5

Repro steps

Because of AngularFire integration, the service worker is not created by just following the default steps as discussed in the guide.

I have to add the code:
platformBrowserDynamic().bootstrapModule(AppModule).then(() => {
if ('serviceWorker' in navigator && environment.production) {
navigator.serviceWorker.register('/ngsw-worker.js');
}
}).catch(err => console.log(err));
as described in this thread:
#8779

When deploying to production, then the service worker is created as it should be.

Observed behavior

The next time I deploy a new version of the code, the site refuses to load and the following error is displayed in the console:
capture

If I delete the service worker through chrome devtools and refresh, the site loads normally.

@filipesilva
Copy link
Contributor

Thanks for reporting this issue. This issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

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

No branches or pull requests

3 participants