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

Cannot set breakpoints in Meteor builds of node server app #22818

Closed
brucejo75 opened this issue Mar 18, 2017 · 11 comments
Closed

Cannot set breakpoints in Meteor builds of node server app #22818

brucejo75 opened this issue Mar 18, 2017 · 11 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@brucejo75
Copy link

I connected with @weinand, on my stackoverflow posting. Adding issue as requested.

  • VSCode Version: 1.10.2
  • OS Version: Windows 10 Version 1607 (OS Build 14393.953)
  • Meteor: 1.4.3.2 (includes node v4.8)

Steps to Reproduce:

  1. in VS Code: configure launch.json attach:
  {
    "name": "Attach to Server",
    "type": "node",
    "request": "attach",
    "port": 5838,
    "address": "localhost",
    "restart": true,
    "timeout": 20000,
    "sourceMaps": true,
    "protocol": "legacy",
    "outFiles": ["${workspaceRoot}/meris/.meteor/local/build/programs/server/**/*.js"]
  }
  1. in CMD Shell: set NODE_OPTIONS environment variable set NODE_OPTIONS=--debug=5838
  2. in CMD Shell: start meteor: meteor
  3. in VS Code: set a breakpoint on a source file clicking in far left column and get bright red indicator.
  4. in VS Code: attach to the process. Successfully attaches
  5. in webapp (connected to server): execute function that will execute code where breakpoint is set.

Result:

Does not stop debugger at breakpoint set in my source file.

Other observations:

  • if I put a debugger; statement into the code
  1. The debugger will break on the debugger statement and I can interact with the code using the VS Code debugger;
  2. The debugger does not break in my source code, it brings up another tab with the source code in it. The source code has a sub-title "read-only inlined content from source map". And the file location is at \1001\.
  • if instead of attaching a VS Code debugger, I attach node-inspector everything works as I expect. After attaching node-inspector all of my set breakpoints hit. No debugger; statements required.
  1. After step 3 above: in CMD shell: node-debug --debug-port=5838
  2. Breakpoints set in node-inspector hit as expected.
  • I understand source maps in concept, but I do not understand the format of the file. But in the sources array, the references to my source files look like this

"meteor://💻app/server/main.js"

It looks a little odd to me... what is with this 💻 character?

Comments

  • Let me know if there are some questions you need answered from the Meteor Development Team. I will see if I can get them to engage.
  • Let me know if you need any other repro information.
@brucejo75 brucejo75 changed the title Cannot set breakpoints in Meteor Code Cannot set breakpoints in Meteor builds of node app Mar 18, 2017
@brucejo75 brucejo75 changed the title Cannot set breakpoints in Meteor builds of node app Cannot set breakpoints in Meteor builds of node server app Mar 18, 2017
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 18, 2017
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Apr 6, 2017
@brucejo75
Copy link
Author

Hi @weinand, @roblourens, any update on this? Thanks!

@roblourens
Copy link
Member

Meteor writes sourcemaps with fake meteor:// paths that the legacy node debugger has trouble resolving to files on disk. Your best shot is probably

  • Changing the meteor config to output actual paths in sourcemaps instead of something like "meteor://💻app/server/main.js" (if this is possible)
  • Or using a recent Node version and using "protocol": "inspector" which is able to deal with the special meteor paths
  • Or continue using the workaround you've found already with debugger statements

@brucejo75
Copy link
Author

Thanks @roblourens, any thoughts on why node-inspector is able to handle the fake meteor:// paths?
I am writing an issue for the meteor folks and want to make sure I understand this.

Thanks!

@roblourens
Copy link
Member

Because it doesn't need to map the paths to files on disk, which is the hard part. It just takes them as is.

@brucejo75
Copy link
Author

brucejo75 commented Apr 13, 2017

Got it!
Thanks @roblourens!

@teknologist
Copy link

teknologist commented May 26, 2017

Hi @roblourens Strange thing here....

If I open node-inspector (I mean http://localhost:8080/?port=5858 in Chrome) once, then I can put break points on vscode (I have VSCode connected to 5959 in legacy mode) and have it stop there and show debug infos, that is even after closing the node-inspector window completely.

I just need to open http://localhost:8080/debug once, let it load everything and the close it.

What do you think ?

Many thanks in advance

@roblourens
Copy link
Member

roblourens commented May 26, 2017

Sure, that could work. The app will be in debug mode even when node-inspector is detached. I'm not sure what you're asking.

@teknologist
Copy link

teknologist commented May 27, 2017

Hi @roblourens

What I am saying is that if I just launch vscode and attach , no breakpoints work.

now if I just launch node-inspector once, let it load then close the window, I go back to VSCode and everything works. I can set breakpoints IN VSCode and I don't need to leave node-inspector open.

So basically I just need to launch node-inspector once at the start of the debugging session and close it immediately (I don't need to keep it open, nor I need to set breakpoints or anything in it))... Then I can work debugging in VSCode for as long as I want.

Previously I didn't need to launch node-inspector at all, it would work out of the box from VSCode.

Hope I am making myself clearer this time....

@roblourens
Copy link
Member

I see. Can you open a new issue for that? Sounds like it's not related to this one.

@matthova
Copy link

@teknologist did you make a new issue for this? I'm interested as well.

@teknologist
Copy link

teknologist commented Jul 18, 2017

@matthova Haven't had the time. but I can confirm, I can only set breakpoints in Node inspector.
As soon as I set them in NodeInspector , VSCode stops at the breakpoints and the debug IDE works fine. Breakpoints set in VSCode are plainly ignored.

Feel free to open an issue.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

5 participants