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

Attach debugger to existing node.js process #137084

Closed
dpkirchner opened this issue Nov 12, 2021 · 4 comments
Closed

Attach debugger to existing node.js process #137084

dpkirchner opened this issue Nov 12, 2021 · 4 comments
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@dpkirchner
Copy link

It would be useful to have a way to attach to an existing node.js process, perhaps by pid, and specifically one that was not started from within VSCode. There is a "Debug: Attach to node process" option, but it doesn't show all processes, and sometimes shows none.

This is related to this an already reported bug[0] and someone (in another issue that I can't find now) suggested this extension: https://github.com/aprilandjan/vscode-node-debug-process-picker but it no longer works (doesn't provide the documented command).

I'm calling it a feature request for this GH issue as it seems like it's not currently supported (or intended to be supported).

0: #10050

@dpkirchner
Copy link
Author

Actually, I think I made a mistake. This should be filed under the vscode-js-debug project, shouldn't it? If so I'll move it over.

@weinand weinand assigned connor4312 and unassigned weinand Jan 11, 2022
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 11, 2022
@connor4312
Copy link
Member

@dpkirchner can you give an example/reproduction of a process where you expect to be able to attach but cannot?

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Jan 11, 2022
@dpkirchner
Copy link
Author

@dpkirchner can you give an example/reproduction of a process where you expect to be able to attach but cannot?

Sure -- I'm running my node processes inside pm2 (coincidentally also a node process), and pm2 overwrites process.title with something like node /path/to/entry/script.js (with a space). As the plugin looks for the process name by strict regex the /^(?:node|iojs)$/i the process isn't found. If I had a way to tell it to look for programs with an alternative pattern, I think it would work fine.

Another example use case that might be relevant, but that isn't exactly what I'm doing, is when someone has more than one node version installed and calls it by a different name (e.g. node-1.2.3 instead of just node).

@connor4312
Copy link
Member

connor4312 commented Jan 12, 2022

Thanks, I made that regex a bit more lenient. The next nightly build will have the fix.

@connor4312 connor4312 added this to the January 2022 milestone Jan 12, 2022
@connor4312 connor4312 added author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 12, 2022
@roblourens roblourens added the verified Verification succeeded label Jan 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants