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] Incomplete process.versions can cause native loading issues at the backend #7358

Closed
kittaakos opened this issue Mar 17, 2020 · 0 comments · Fixed by #7386
Closed
Labels
electron issues related to the electron target

Comments

@kittaakos
Copy link
Contributor

Description

Inside a bundled electron application, we lose the electron and chrome properties from the process.versions. This can cause module-loading issues inside a bundled Theia application. For instance, one cannot require grpc at the Theia backend.

Originally from here:

The electron-v4.2-darwin-x64-unknown file is the correct one for Electron 4.2

This helped a lot 👍 In our app we fork several processes from the electron main. So I logged process.versions in the main electron module and at the very first grpc require and I can see a difference.

{
  "http_parser": "2.8.0",
  "node": "10.11.0",
  "v8": "6.9.427.31-electron.0",
  "uv": "1.23.0",
  "zlib": "1.2.11",
  "ares": "1.14.0",
  "modules": "69",
  "nghttp2": "1.33.0",
  "napi": "3",
  "openssl": "1.1.0",
  "electron": "4.2.12",
  "chrome": "69.0.3497.128",
  "icu": "62.2",
  "unicode": "11.0",
  "cldr": "33.1",
  "tz": "2019a"
}
{
  "http_parser": "2.8.0",
  "node": "10.11.0",
  "v8": "6.9.427.31-electron.0",
  "uv": "1.23.0",
  "zlib": "1.2.11",
  "ares": "1.14.0",
  "modules": "69",
  "nghttp2": "1.33.0",
  "napi": "3",
  "openssl": "1.1.0",
  "icu": "62.2",
  "unicode": "11.0",
  "cldr": "33.1",
  "tz": "2019a"
}
11a12,13
>   "electron": "4.2.12",
>   "chrome": "69.0.3497.128",

If apply the following hack inside my bundled app, something like this, then it works:

process.versions.electron = "4.2.12";
process.versions.chrome = "69.0.3497.128";
"use strict";

// ...

var grpc = require("grpc");

Reproduction Steps

OS and Theia version:

Diagnostics:

@kittaakos kittaakos added the electron issues related to the electron target label Mar 17, 2020
kittaakos pushed a commit that referenced this issue Mar 18, 2020
A process, forked from the electron main, does not contain the
`process.versions.electron` entry, which causes native loading issues.
Instead of forking, we `spawn` a process and set the IPC channels.

Closes #7358
Closes #4288
Closes #4875

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
kittaakos pushed a commit that referenced this issue Mar 18, 2020
A process, forked from the electron main, does not contain the
`process.versions.electron` entry, which causes native loading issues.
Instead of forking, we `spawn` a process and set the IPC channels.

Closes #7358
Closes #4288
Closes #4875

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target
Projects
None yet
1 participant