electronwindowchromiumelectron-builder

Some Windows PCs forces Sandbox mode on Electron Chromium


Hey I developed a configuration App in Electron for my NestJS server. This setup installs the IIS and configures the NestJS API on customer PCs. However on some PCs, the Electron app crashes at startup, and the Event Viewer in Windows shows the error code 0x80000003.

After a couple of time we tried to start the app with the parameter --no-sandbox and it works, but Electron states that I should only use this flag for testing purposes and not in production. Aside from thad on initialization of the BrowserWindow I say in the webPreferences nodeIntegration: true and sandbox: false but there was no change on the customers' PCs. In my opinion the security guidelines of the customer forces the sandbox mode for Chromium.

And now to my question: Is it possible to disable sandbox mode through code, or is there something in my packages triggering the security guidelines on customer PCs?"

heres my package.json

{
  "name": "xxxxxxxxxxxxxxx",
  "version": "xxxxxxxxxxxxxxx",
  "description": "xxxxxxxxxxxxxxx",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "package": "electron-builder --win ",
    "dist": "electron-builder build --win"
  },
  "author": "xxxxxxxxxxxxxxx",
  "license": "ISC",
  "dependencies": {
    "@electron/remote": "^2.1.2",
    "aes-js": "^3.1.2",
    "alpinejs": "^3.10.2",
    "cllicense": "file:xxxxxxxxxxxxxxx/xxxxxxxxxxxxxxx/xxxxxxxxxxxxxxx.tgz",
    "cryptr": "^6.0.3",
    "electron-log": "^4.4.8",
    "extract-zip": "^2.0.1",
    "mssql": "^8.1.4",
    "node-fetch": "^2.6.12",
    "qrcode": "^1.5.1",
    "semver": "^7.3.8"
  },
  "devDependencies": {
    "electron": "^28.2.2",
    "electron-builder": "^24.13.0",
    "electron-packager": "^15.4.0"
  },
  "build": {
    "productName": "xxxxxxxxxxxxxxx",
    "artifactName": "xxxxxxxxxxxxxxx.${ext}",
    "copyright": "xxxxxxxxxxxxxxx",
    "extraFiles": [
      "assets"
    ],
    "win": {
      "target": "nsis",
      "requestedExecutionLevel": "requireAdministrator",
      "icon": "build/logo_setup.ico",
      "certificateSubjectName": "xxxxxxxxxxxxxxx",
      "signingHashAlgorithms": [
        "sha256"
      ],
      "publisherName": "xxxxxxxxxxxxxxx"
    },
    "nsis": {
      "oneClick": false,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true,
      "allowElevation": false,
      "installerIcon": "build/logo_setup.ico",
      "installerHeaderIcon": "build/logo_setup.ico",
      "language": "0x0407",
      "include": "build/installer.nsh",
      "runAfterFinish": false,
      "installerSidebar": "build/installerSidebar.bmp",
      "uninstallDisplayName": "xxxxxxxxxxxxxxx"
    }
  }
}


Solution

  • I found the error. The reason was that some customer servers are VMs without a GPU. Electron tries to render the Window with the GPU. With this code at the top of my main.js, the application starts: app.commandLine.appendSwitch('--in-process-gpu')