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

Cannot read properties of undefined (reding 'pushManager') #134

Open
NicoCaldo opened this issue Sep 28, 2023 · 4 comments
Open

Cannot read properties of undefined (reding 'pushManager') #134

NicoCaldo opened this issue Sep 28, 2023 · 4 comments

Comments

@NicoCaldo
Copy link

On Chrome I'm getting an error on line 95 of webpush.js when I try to subscribe with the error

Cannot read properties of undefined (reding 'pushManager')
at subscribe (webpush.js:95:7)
at HTMLButtonElement.<anonymous> (webpush.js:16:14)

I've correctly created the VAPID key like the documentation describe

@NicoCaldo
Copy link
Author

NicoCaldo commented Sep 28, 2023

Everything works fine if I use localhost but when I try to access my server within the local network using http://my_ip I got the error. Even from localhost but using any localhost IP (0.0.0.0) and/or (127.0.0.1) the error occurs

@NicoCaldo
Copy link
Author

NicoCaldo commented Sep 28, 2023

It turned out you need your server to run on HTTPS

I have geenrated a self signed certificate on my server matching its IP and loclahost but now the error is

An unknown error occurred when fetching the script.
my_ip/:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://my_ip:8080/webpush/') with script ('https://my_ip:8080/webpush/service-worker.js'): An unknown error occurred when fetching the script.

Now, in Mozilla works correctly, in Chrome i'm having the issue above

@NicoCaldo
Copy link
Author

NicoCaldo commented Sep 28, 2023

It seems the worker is not loaded in Chrome
image

@NicoCaldo
Copy link
Author

Could it be chrome doesn't allow self-signed certificate for web workers?

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

1 participant