eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.11k stars 2.5k forks source link

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

Open aghayanlena opened 8 months ago

aghayanlena commented 8 months ago

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:///socket.io/?EIO=4&transport=polling&t=OvSpqm9

Although, from the logs, it is listening to http://127.0.0.1: . The same request that is addressed to localhost returns the response successfully: $ curl http://127.0.0.1/:/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.

tsmaeder commented 8 months ago

@aghayanlena How does the UNC path get in there? How do you build the executable? Also, could you share the browser and console logs, please?

aghayanlena commented 8 months ago

Hi @tsmaeder ,

I installed the Theia executable on one of my servers and ran it via the UNC path from another machine.

Those are the steps that I use to generate the package: $ yarn $ yarn build $ yarn dist

You can find the package.json and electron-builder.json files in the bug description.