stoplightio / desktop

The Stoplight desktop app + issues repository.
https://stoplight.io
78 stars 13 forks source link

[SL-1037] - Unable to login in a desktop app #352

Closed rainum closed 5 years ago

rainum commented 5 years ago

I'm the only one person affected by this issue in a Stoplight team. As I figured out other people have this issues as well according to an Electron community. It is actually really rare, but it completely breaks an app because you can't login.

This issue is caused by an electron-ga package. It is used in a app/utils/browser/index.js file. Error is thrown on creating new instance of Analytics` class. Because of this error app/utils/browser/index.js‌can not be loaded by the BrowserWindow preload, that is why app menu, hotkeys and auth are not working.

electron-ga uses a node-machine-id packages as a dependency. node-machine-id tries to obtain env info with a command which results in an error:

Error: Command failed: ioreg -rd1 -c IOPlatformExpertDevice
/bin/sh: ioreg: command not found

BrowserWindow preload is unique because it has node and browser environments available at a same time. node-machine-id runs in a node env during preload process. Most likely error is caused by some problems in my machine configuration. Unfortunately this can not be fixed from apps side. I added an additional try/catch to prevent a preload process from breaking by this error.