Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 2.05 KB

19-008.md

File metadata and controls

51 lines (30 loc) · 2.05 KB
date
Thu Oct 19 2017 12:29:00 GMT+1100 (AEDT)

upgrading electron-hot

my fork: https://github.com/joshwnj/electron-hot

Overview:

  • a few libs are out of date, and electron-prebuilt is deprecated

  • still works when I upgrade electron alone, but after updating chokidar and chrome-remote-interface it's not picking up changes.

  • getting this error in the console:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unable to connect to client

So it's not connecting to the chrome remote debugger. First let's handle that promise rejection.

Error: Unknown implementation

from https://github.com/cyrus-and/chrome-remote-interface/blob/c6c222de4330ff3d505ff0ea0ddf1c5528d24d92/lib/devtools.js#L29

It's checking the browser against a whitelist to see if the browser is supported. I wonder what browser electron is reporting?

So it looks like electron reports Browser: '', which is why it's failing the whitelist.

Is there a way to set that Browser value? Not quite sure what to search for... I can see a way to override the User-Agent value, however it doesn't seem to be picked up by chrome-remote-interface.

Before going further, I can see that this browser whitelisting block was changed in v0.25.0. I know it worked at some point, so I'll try an older version.

Sure enough, it works fine in v0.24.0. That might give some clues about what changed.

Ok, one of the other things that changed in the minor version was how the options.local and options.remote defaults are handled:

https://github.com/cyrus-and/chrome-remote-interface/commit/1457e73c4893a23241406d9a174930471da2d30c#diff-9f4c72d1c55ab2ef303fc0c00bf42498L12

-    if (!options.remote) {
+    if (options.local) {

Instead of asking "is it not remote", it's asking "is it local". Without that explicit opt-in, it won't look for a local connection (which is what we have with electron). Let's try that out.

Hooray it worked!!1!