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

Electron 'remote' module is considered harmful #37

Open
LRode opened this issue Mar 9, 2022 · 2 comments
Open

Electron 'remote' module is considered harmful #37

LRode opened this issue Mar 9, 2022 · 2 comments

Comments

@LRode
Copy link

LRode commented Mar 9, 2022

Describe the bug
Starting in Electron version 10, the electron remote module is disabled by default. You have to manually enable it, and the Electron docs recommend moving away from using it (For many reasons see this article).

As we are using the launchdarkly-electron-client-sdk in an Electron version greater than 10, we had to enable remote module to use it. I was wondering if there are any plans to upgrade the code and move away from the remote module.

To reproduce

  • Import launchdarkly-electron-client-sdk in Electron renderer process, with Electron version 10+.
    (In our case, we are using it in the renderer preload script)
  • Renderer fails to load, and can see error messages that electron remote is undefined

Workaround:

  • Add enableRemoteModule: true to webPreferences of BrowserWindow
  • Or: implement custom IPC methods to communicate from main to renderer and don't use launchdarkly-electron-client-sdk in the renderer.

Expected behavior
Importing launchdarkly-electron-client-sdk without enableRemoteModule: true should work without errors.

Logs
image
image

SDK version
1.6.3

Language version, developer tools
Electron: 13.6.3, Typescript: 4.6.0

OS/platform
macOS 11.6

@eli-darkly
Copy link
Contributor

We do plan to revisit the Electron SDK code and update it for more modern Electron versions. We don't have a time frame for that yet— it has been a low priority because we haven't had much demand for Electron— but we expect that our next release will be a major version release that will revise the architecture to address issues like this, and will also drop support for EOL versions of Electron (which currently would mean all versions below 14).

LaunchDarklyReleaseBot pushed a commit that referenced this issue Oct 21, 2022
update js-eventsource to remove vulnerability warning
@psoares
Copy link

psoares commented May 18, 2023

We're using electron 18.2.4. The client works fine on the main process, but fails on the renderer on this call:

function getMainEntryPoints() {
  // See mainEntryPointsFromRenderer.js
  return electron.remote.require('launchdarkly-electron-client-sdk/src/mainEntryPointsFromRenderer');
}

It seems like electron 18 doesn't expose a remote method anymore, even if I specify enableRemoteModule: true on my BrowserWindow's webPreferences,

See https://www.electronjs.org/docs/latest/breaking-changes#planned-breaking-api-changes-140

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

3 participants