eclipse-theia/theia

Frontend initialization of electron app fails on Windows when runing the exe via UNC path

Open

#13.512 aberto em 21 de mar. de 2024

Ver no GitHub
 (2 comments) (0 reactions) (0 assignees)TypeScript (2.478 forks)batch import
help wantedmessaging

Métricas do repositório

Stars
 (18.676 stars)
Métricas de merge de PR
 (Mesclagem média 12d 10h) (73 fundiu PRs em 30d)

Description

Bug Description:

The initialization of my theia custom electron application fails on Windows when running theia via UNC path. ( --no-sandbox option is presented) From the Network tab of DevTools the following request is refused: Request URL: http://<server_name_of_UNC_paht>/socket.io/?EIO=4&transport=polling&t=OvSpqm9

Although, from the logs, it is listening to http://127.0.0.1:<port_number> . The same request that is addressed to localhost returns the response successfully: $ curl http://127.0.0.1/:<port_number>/socket.io/?EIO=4&transport=polling 0{"sid":"cx7PqAU7lTT64JufAAAB","upgrades":["websocket"],"pingInterval":30000,"pingTimeout":60000,"maxPayload":100000000}

Steps to Reproduce:

I use the following configuration to build/package my custom theia application:

package.json of electron-app

{
  "private": true,
  "name": "Custom_theia",
  "version": "0.0.1",
  "description": "Custom Theia app",
  "author": "Custom",
  "main": "src-gen/backend/electron-main.js",
  "dependencies": {
    "@theia/core": "1.46.1",
    "@theia/electron": "1.46.1",
    "@theia/preferences": "1.46.1",
    "@theia/filesystem": "1.46.1",
    "@theia/workspace": "1.46.1",
    "@theia/plugin-ext-vscode": "1.46.1",
    "node-gyp": "^9.0.0"
  },
  "devDependencies": {
    "@theia/cli": "latest",
    "electron": "^23.2.4",
    "electron-builder": "^23.0.3",
  },
  "theiaExtensions": [
  ],
  "theiaPluginsDir": "plugins",
  "scripts": {
    "theia_build": "theia build",
    "rebuild_electron": "theia rebuild:electron",
    "build": "yarn theia_build && yarn rebuild_electron",
    "start_win": "theia start --mode=electron --plugins=local-dir:./plugins",
    "start_lin": "theia start --mode=electron --no-sandbox --plugins=local-dir:./plugins",
    "dist": "electron-builder"
  },
  "theia": {
    "target": "electron",
    "frontend": {
      "config": {
        "applicationName": "Custom Theia"
      }
    }
  }
}

electron-builder.json

{
	"appId": "custom.theia",
	"productName": "custom_theia",
	"electronDist": "../node_modules/electron/dist",
        "electronVersion": "23.2.4",
	"asar": false,
	"files": [
		"src-gen",
		"src",
		"lib",
		"!**node_modules/electron/**"
	],
	"extraResources": [
		{
			"from": "./plugins",
			"to": "plugins"
		}
	],
	"win": {
		"executableName": "custom_theia",
		"artifactName": "${productName}_${version}.${ext}",	
		"target": [
			"nsis"
		]
	},
	"linux": {
		"executableName": "custom_theia",
		"artifactName": "${productName}_${version}.${ext}",
		"category": "Development",
		"target": [
			"AppImage"
		]
	},
	"nsis": {
		"oneClick": false,
		"perMachine": false,
		"allowToChangeInstallationDirectory": true,
		"runAfterFinish": false,
		"artifactName": "${productName}_${version}_Setup.${ext}",
		"uninstallDisplayName": "${productName}"
	},
}

Steps to reproduce:

  1. yarn
  2. yarn build
  3. yarn dist
  4. run the generated executable under the dist/win-unpacked directory through the UNC path with the --no-sandbox option.

The front-end does not open successfully; it keeps sending the socket.io request (mentioned in the bug description) forever.

Additional Information

Don't see the same behavior on Linux.

  • Operating System: Windows
  • Theia Version: 1.46.1

Guia do colaborador