question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Javascript debugger does not connect to headless instance

See original GitHub issue

Environment (please complete the following information):

  • OS: MacOS 12.1 (M1 Mac Mini)
  • Extension version: 1.4.5

Describe the bug:

The Javascript debugger does not connect to headless Edge instance.

Repro steps:

  • Launch web server with npm in debug shell
  • Launch edge devtools in headless mode with screencast
  • Debugger does not attach and breakpoints remain disabled

Expected behavior:

Debugger should attach to the instance of Edge running headless with screencast, just like it does with a separate Edge window.

Additional context:

I am attempting to launch my app using a compound configuration in launch.json (see below for specifics). If I launch Edge using type: pwa-msedge then my web server debugger attaches just fine and breakpoints work as expected. I can also attach the Edge DevTools in VSCode to that running instance.

However, I would ideally like a completely unified dev experience, with code, dev tools, and browser embedded within a single VSCode window. I can launch an independent, headless instance of Edge with screencast in my VSCode window, but launching the DevTools directly in this manner does not connect to my app’s debugger/breakpoints.

Snippets from launch.json

"configurations": [
    {
      "name": "Open App",
      "request": "launch",
      "type": "pwa-msedge",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}",
    },
    {
      "name": "Open App (Headless)",
      "request": "launch",
      "type": "vscode-edge-devtools.debug",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}",
    },
    {
      "name": "Start App",
      "command": "npm run start",
      "request": "launch",
      "type": "node-terminal"
    }
],
"compounds": [
    {
      "name": "Debug App (Works)",
      "configurations": ["Start App", "Open App"]
    },
    {
      "name": "Debug App (Does not work)",
      "configurations": ["Start App", "Open App (Headless)"]
    }
]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
codepo8commented, Feb 22, 2022

You can add the headless option to your launch.json and it works (at least here right now). Notice the runtimeArgs.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-msedge",
            "request": "launch",
            "name": "webdebug",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}",
            "runtimeExecutable": "stable",
            "runtimeArgs": ["--headless"]
        }
    ]
}
1reaction
5hee75commented, Feb 23, 2022

You can add the headless option to your launch.json and it works (at least here right now). Notice the runtimeArgs.

This is nice workaround for the time being. If I include both the headless pwa-msedge as well as the vscode-edge-devtools.debug then it effectively behaves as desired. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode debugger can not connect to puppeteer instance run ...
Connecting the debugger to a headless Chrome instance started with chrome --headless --remote-debugging-port=9333 works fine.
Read more >
Can't connect to WS after launching separate headless ...
I have been looking into this issue. I have a solution that seems to work for remote connected and new browser instances for...
Read more >
Sanely debugging puppeteer and fixes to common issues
At the end of this post you'll have much better tools and methods for debugging some of the tougher problems in headless Chrome....
Read more >
Debug Browser Apps using Visual Studio Code
Visual Studio Code includes a built-in debugger for Edge and Chrome. There are a couple ways to get started with it. Use the...
Read more >
headless - chromium/src.git - Git at Google
Headless Chromium can be built as a library for embedding into a C++ application. This approach is otherwise similar to controlling the browser...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found