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

Do you have `Cannot read property 'addEventListener' of undefined`? #203

Closed
panlina opened this issue Oct 26, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@panlina
Copy link

commented Oct 26, 2018

  • Version (cloudcmd -v): at least since v11.1.0
  • Node Version node -v: v8.11.4
  • Browser name/version: Chrome 68
  • Used Command Line Parameters: (no arguments)

Just run cloudcmd without any arguments and open the page. The devtool shows:

Uncaught (in promise) TypeError: Cannot read property 'addEventListener' of undefined
    at cloudcmd.js:68
    at Generator.next (<anonymous>)
    at n (key.js:79)
    at u (key.js:79)

Not sure whether this has any impact, but do you have this?

@coderaiser

This comment has been minimized.

Copy link
Owner

commented Oct 29, 2018

No I can't reproduce this, please try to clear site data.
image
Is it helped?

@panlina

This comment has been minimized.

Copy link
Author

commented Oct 31, 2018

I cleared site data and the error remains. I find this error does not exist with Edge. And in chrome it's caused by navigator.serviceWorker being undefined, at

if (!navigator.serviceWorker)
. Not sure how this happens yet. I'll debug again and find why this happens for me.

@coderaiser

This comment has been minimized.

Copy link
Owner

commented Oct 31, 2018

if navigator.serviceWorker is undefined it should exit function and do not try to register itself.
You can try to update chrome to v70.

@panlina

This comment has been minimized.

Copy link
Author

commented Nov 1, 2018

I'm already using v70. Now from my debug this issue is not related to cloudcmd. I'm using a minimum server serving like .use((req, res) => res.send("<script>console.log(navigator.serverWorker);</script>"). This issue happens when it's served from a remote server without https and browsed from Chrome. I did a search and found https://www.chromestatus.com/feature/4835970390163456. It's probably the cause.

@coderaiser coderaiser reopened this Nov 1, 2018

@coderaiser

This comment has been minimized.

Copy link
Owner

commented Nov 1, 2018

I understood what are you talking about. I didn't test this case for a long time, just tried it and I managed to reproduce this bug, thank you for explanation :).

@coderaiser

This comment has been minimized.

Copy link
Owner

commented Nov 1, 2018

Fixed with b782c0a, landed in v11.7.1 🎉

@coderaiser coderaiser closed this Nov 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.