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

SSL related errors when trying to add service worker #347

Open
gigamesh opened this issue Jan 18, 2019 · 7 comments
Open

SSL related errors when trying to add service worker #347

gigamesh opened this issue Jan 18, 2019 · 7 comments

Comments

@gigamesh
Copy link

Hello - I'm up to the service worker section of the course, but I'm running into these errors when adding the service worker:

image

Relevant code in index.js:

if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('service-worker.js').then(registration => {
    console.log('REGISTERED!!');
  });
}

I have Chrome set to not require SSL on localhost, but it still seems to be asking for a certificate. This is what it looks like when I comment out the above code:
image

Any ideas how to fix this?

@mike-north
Copy link
Member

You shouldn't need SSL anymore, as http://localhost is considered a secure domain. I'll take a quick look

@gigamesh
Copy link
Author

Thanks Mike - love all your courses by the way!

@mike-north
Copy link
Member

@gigamesh do you have any errors in your terminal?

I would try to run the app on http://localhost:3000 by running yarn start or npm start instead of trying to get https working.

At the time we recorded this course there were some nasty chrome bugs that required each student to generate a self-signed certificate, but as far as I can tell they've all been straightened out.

@gigamesh
Copy link
Author

yarn start also results in it running on https -- I can't really make sense of the server code so I wouldn't know what to change. Looks like there is a lot of https stuff happening.

@tymochko
Copy link

tymochko commented Mar 9, 2020

@mike-north I am not sure if this is related but I am going step by step by README.MD but getting Privacy Error on localhost:3000

Certificate is invalid, not trusted.

I tried to delete whole project and do it again and again but not use.

Screenshot 2020-03-09 at 18 58 53

@MichaelDurfey
Copy link

@tymochko you can get around this chrome error by typing thisisunsafe in the browser window. I think maybe chrome changed rules about self-signed certificates?

@nielsboecker
Copy link

nielsboecker commented Jun 3, 2020

I am also experiencing some trouble with this. For me, it does not work on Chrome. Interestingly, Chrome marks the certificate as "Invalid", even though it seems valid when you inspect it:

image

image

This leads to an error when I try to register the SW:

app-d5c93b203741af8b7e1b.js:2538 DOMException: Failed to register a ServiceWorker for scope ('https://localhost:3000/') with script ('https://localhost:3000/service-worker.js'): An SSL certificate error occurred when fetching the script.

I wonder if this might have something to do with the certificate validity being too long?

Anyway, it does seem to work in Safari, and the SW registration was successful there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants