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.

Cannot attach to debugger

See original GitHub issue

Hope this is the right place/project, otherwise my apologies.

When debugging nodejs using attach, vscode connects to the nodejs debugger using the address specified in launch.json

However, it seems to always use “localhost” in the host header for the requests it make.

This prevents me from routing the traffic through a proxy which needs host names in order to route properly

Is there anyway to control the host header in vscode’s requests to the nodejs debugger?

Thanks

A sniffed snippet example from request vscode => nodejs debugger:

GET /json/version HTTP/1.1
user-agent: got (https://github.com/sindresorhus/got)
accept: application/json
host: localhost
accept-encoding: gzip, deflate, br
Connection: close

Another snippet from the ws upgrade request:

GET /6cabf470-7eb5-4202-b11f-4355c178c8a3 HTTP/1.1
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: qDfnpxTOzSjxQfbiJcsTWQ==
Connection: Upgrade
Upgrade: websocket
host: localhost

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
gielfeldtcommented, Sep 30, 2020

Thanks for the quick reply. I’ll see what I can do and create a PR for it.

2reactions
connor4312commented, Sep 30, 2020

However, it seems to always use “localhost” in the host header for the requests it make.

This is required; if the host isn’t set to localhost then the debug target (node or chrome) will refuse to respond with debug information.

If the host header is not localhost, you will need to fix it up in your proxy. I would be willing to accept a PR to configure a custom value for the host header.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Attach to the Process - Visual Studio (Windows)
Run the debugger and managed application under the same user account name and password. To solve Scenario 2. From the Start menu, choose...
Read more >
Visual studio debugger won't attach to chrome
I'm trying to attach to an instance of chrome running a react page, using node as a server. I want to attach to...
Read more >
Cannot attach debugger to Helper app on macOS
I've got a macOS app with a "Helper" (LoginItem) app that I'd like to attach the debugger to in order to debug the...
Read more >
Unable to attach to the process. The system cannot find the file ...
First go to Tool->Options->Tools for Apache Cordova->Run Dependency Checker to make sure you installed all the required components. You might ...
Read more >
Node.js debugging - cannot attach debugger to subprocesses
Basically I am having trouble attaching the VS Code debugger to the subprocesses I have in my Node app. It only attaches 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