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.

How to debug a web app running in an another VSCode instance?

See original GitHub issue

Firstly I have to say that this extension has a potential of becoming on of the most important VSC extensions, sadly either I don’t get how to make it work with my project or there is a big problem with it…

So, I have a node.js Express web app that I develop&debug with VSCode. And immediately I have a problem placing launch config for client side debugging in the same folder. It would have been nice being able to debug client-side and server-side scripts in the same IDE instance, but afaik VSCode allows only one debugger at a time, and since you can’t open the same folder/project twice with VSCode - I tried to nest it:

webapp.dev/
|-.vscode/    - express app configs
|-static/
  |-js/
    |-.vscode/    - vscode-firefox-debug configs
    |-index.js
|-webapp.js

and I used the following launch.json in vscode-firefox-debug configs folder

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch index",
            "type": "firefox",
            "request": "launch",
            "url": "http://webapp.dev", //localhost actually, domain adssigned locally in hosts file
            "webRoot": "D:/Projects/webapp.dev",
            "profile": "VSCodeDebugode" // devtools.debugger.remote-enabled, devtools.chrome.enabled, devtools.debugger.workers, devtools.debugger.prompt-connection are set as suggested
        }
    ]
}

Theoretically it should work, since my express static paths resolve also to static/js/. So When i try to do something in, for example, static/js/index.js, like setting a breakpoint - I get

WARN |007.119|FirefoxDebugSession: Can't convert path d:/Projects/webapp.dev/static/js/index.js to url

BTW, notice how the error states d:/... and my config has D:/.... If I also use d:/ in the config - debugger doesn’t even recognize the static/js/index.js file (breakpoints are gray and no errors on setting them). Adding terminating / doesn’t help either.

I think the problem is that there is no .html file under webRoot. There is no, because html is generated with a templating engine and cached in-memory only.

So is this even possible? If so, how? If not - consider it a feature request: maybe an option to ignore html and watch only for js?

Also, it is stated in the readme that devtools.debugger.remote-enabled, devtools.debugger.prompt-connection are only needed for attach, but without devtools.debugger.remote-enabled the launch request won’t work either. I think you should move this table in the #Starting section.

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
hbenlcommented, Jul 26, 2016

😃 Great! I’ll fix the filepath-to-url mapping code soon so others won’t stumble into these problems. Thanks for the bugreport and the sample project!

0reactions
hbenlcommented, Sep 6, 2016

Yes, you’re right. I didn’t want to mess with the user’s configuration (automatically lower-casing drive letters) because if there is a setup where VS Code expects an upper-case drive letter I would break the user’s configuration. Anyway, now that the webRoot path is normalized, the need to manually enter an absolute path should be gone, since only webRoot paths that are relative to the workspace make sense and they can now be entered like ${workspaceRoot}/...

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug Browser Apps using Visual Studio Code
The simplest way to debug a webpage is through the Debug: Open Link command found in the Command Palette (Ctrl+Shift+P). When you run...
Read more >
Debug Node.js Apps using Visual Studio Code
The Visual Studio Code editor includes Node.js debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Introduction to Debugging in Visual Studio Code
Debugging that "just works". Run a sample Node.js app. Use a launch.json configuration file. Single file debugging. Set a breakpoint.
Read more >
Debugging on multiple instances of web app #107221 - GitHub
I want Visual Studio Code to launch an ASP.Net web app with multiple instances when debugging, and routing my requests to a different...
Read more >
LIVE : Web Debugging in Visual Studio Code - YouTube
Join Connor and Brandon as they develop and debug a webpage with VS Code. You'll learn how to use the JavaScript debugger to...
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