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

Error starting the debug session TypeError: is_electron_1.default is not a function #9729

Closed
planger opened this issue Jul 13, 2021 · 3 comments · Fixed by #9730
Closed

Error starting the debug session TypeError: is_electron_1.default is not a function #9729

planger opened this issue Jul 13, 2021 · 3 comments · Fixed by #9730
Labels
electron issues related to the electron target vscode issues related to VSCode compatibility

Comments

@planger
Copy link
Contributor

planger commented Jul 13, 2021

Bug Description:

The following error occurs when a debug session is started involving a debug adapter contributed by a VSCode plugin:

root ERROR Error starting the debug session TypeError: is_electron_1.default is not a function
    at Object.startDebugAdapter (/home/philip/Git/OpenSource/Theia/theia/packages/plugin-ext/lib/plugin/node/debug/plugin-debug-adapter-starter.js:44:48)
    at DebugExtImpl.<anonymous> (/home/philip/Git/OpenSource/Theia/theia/packages/plugin-ext/lib/plugin/node/debug/debug.js:725:82)
    at step (/home/philip/Git/OpenSource/Theia/theia/packages/plugin-ext/lib/plugin/node/debug/debug.js:33:23)
    at Object.next (/home/philip/Git/OpenSource/Theia/theia/packages/plugin-ext/lib/plugin/node/debug/debug.js:14:53)
    at fulfilled (/home/philip/Git/OpenSource/Theia/theia/packages/plugin-ext/lib/plugin/node/debug/debug.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Steps to Reproduce:

  1. Add the VSCode plug-in webfreak.debug, e.g. by adding
    "vscode-native-debug": "https://open-vsx.org/api/webfreak/debug/0.25.1/file/webfreak.debug-0.25.1.vsix"
    to the root package.json.
  2. Run yarn download:plugins and yarn start:browser
  3. Open the Theia browser app in a browser and create a launch config in .vscode/launch.json, such as
{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Debug",
          "type": "gdb",
          "request": "launch",
          "target": "./hello",
          "cwd": "${workspaceRoot}",
          "valuesFormatting": "parseText",
          "printCalls": true
      }
  ]
}
  1. Go to the debug view in the Theia app and Start Debugging the launch config created above
  2. The Theia app shows an error notification and prints the error above into the console

Additional Information

  • Operating System: Ubuntu 20.04.2
  • Theia Version: 1.15.0

Change that introduces the invocation of isElectron():
ab27299#diff-4cbce14389ca5434c2b22540901b6e30978a267684ca1f6636cb54221559f38b

@planger
Copy link
Contributor Author

planger commented Jul 13, 2021

The is-electron package seems to incorrectly export the function isElectron as default in its released version 2.2.0. Their master branch includes a change that likely fixes this issue (cheton/is-electron#5) and / or Theia may require to set the esModuleInterop flag to true in its tsconfig.json. The is-electron fix is not yet released anyway even though there is a bug about it (cheton/is-electron#7).

@paul-marechal What do you think?

In the meantime we could use import the isElectron using require:

const isElectron = require('is-electron');

I'll open a PR with that change.

planger added a commit to planger/theia that referenced this issue Jul 13, 2021
Fix eclipse-theia#9729

Signed-off-by: Philip Langer <planger@eclipsesource.com>
@paul-marechal
Copy link
Member

If TypeScript allows us we could do import isElectron = require('is-electron');.

@planger
Copy link
Contributor Author

planger commented Jul 13, 2021

If TypeScript allows us we could do import isElectron = require('is-electron');.

Unfortunately, TypeScript complains if I do that:

packages/plugin-ext/src/plugin/node/debug/plugin-debug-adapter-starter.ts:48:27 - error TS2349: This expression is not callable.
  Type 'typeof import("/home/philip/Git/OpenSource/Theia/theia/node_modules/is-electron/index")' has no call signatures.

48                 execArgv: isElectron()
                             ~~~~~~~~~~


Found 1 error.

@vince-fugnitto vince-fugnitto added electron issues related to the electron target vscode issues related to VSCode compatibility labels Jul 13, 2021
paul-marechal pushed a commit that referenced this issue Jul 13, 2021
Fix #9729

Signed-off-by: Philip Langer <planger@eclipsesource.com>
dna2github pushed a commit to dna2fork/theia that referenced this issue Aug 25, 2021
Fix eclipse-theia#9729

Signed-off-by: Philip Langer <planger@eclipsesource.com>
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 vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants