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

Sourcemap remote debugging with break points #9742

Closed
tinganho opened this issue Jul 26, 2016 · 51 comments
Closed

Sourcemap remote debugging with break points #9742

tinganho opened this issue Jul 26, 2016 · 51 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@tinganho
Copy link

tinganho commented Jul 26, 2016

I tried a whole day to get remote debugging with break points on my VM, but I didn't succeed. I have read all old issues, blog posts and SO. But I still cannot figure out what I've done wrong?

I have a VM running locally on my Mac at host app.local. Inside the VM I have a folder /home/myusername/app, I have a TS project. Here is my configurations :

    {
        "compilerOptions": {
            "module": "commonjs",
            "target": "es5",
            "noImplicitAny": true,
            "outDir": "Build",
            "rootDir": ".",
            "experimentalDecorators": true,
            "jsx": "react",
            "reactNamespace": "Element",
            "removeComments": true,
            "forceConsistentCasingInFileNames": true,
            "strictNullChecks": true,
            "noEmitOnError": true,
            "noImplicitThis": true,
            "inlineSourceMap": true,
            "inlineSources": true
        },
        "exclude": [
            "node_modules",
            "vendor"
        ]
    }

And here is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "address": "app.local",
            "port": 5858,
            "sourceMaps": true,
            "localRoot": "${workspaceRoot}",
            "remoteRoot": "/home/myusername/app",
            "restart": true
        }
    ]
}

I can see the generated files have inlined source map and inlined sources(I have also tried with non-inlined mapping as well). I start the server node-dev --debug Build/Start.js. After that I attach to the process and succeeds. But the problem comes when I try to set a break point — it fails?

I have also tried many remoteRoot paths to hopefully get the breakpoints working, though failed? I don't think I have a remote idea what I've done wrong at this moment.

@kieferrm kieferrm added *question Issue represents a question, should be posted to StackOverflow (VS Code) debug Debug viewlet, configurations, breakpoints, adapter issues labels Jul 26, 2016
@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

I'm not able to make it work with docker as well (a nodejs/express/typescript app).
I've spent hours on trying all possible combinations of remoteroot, localroot, outdir, inline & external sourcemaps without any success?

Can someone possibly make a clear statement about whether it is supposed to work?
And if yes maybe come up with a sample (a docker sample would be great as it would make it possible to easily run it without complex setup) that would clarify the necessary configuration settings.

That's really frustrating to spend hours and days on something that is maybe not working at all.

For information, I was able to remode debug pure nodejs/express javascript.

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@FredericLatour are you able to set and hit breakpoints in *.js files if the "sourceMaps" attribute in your launch config is set to false?

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand As written I was able indeed to remode debug (and set breakpoints) if no sourcemaps are involved but maybe you are asking for something more specific?

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@FredericLatour I'm asking whether you were able to set and hit breakpoints in *.js files in your Docker/TypeScript app when the "sourceMaps" attribute in your launch config is set to false. If yes, then this means that remoteroot, and localroot are correctly set and we can focus on the source map issue.
I'm not asking about a different nodejs/express javascript app.

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand . Ok. As far as I remember (have done hundreds of tries since then): yes. But for the sake of starting on the right track, I will check right now and will let you know.

As far as I can understand, you are meaning that this is supposed to work. Don't want to look like I'm insisting but why not having a sample docker based repository posted? I mean, if I can clone a repository and see by myself that this is working properly, not only I would be confident to spend additional time on this but also I'll be able to compare the sample configuration/settings with my own configuration.

Will check your specific question now and post back the result.

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

I've just verified on macOS with Docker that this project made available by @delfinof in #2472 works for me without modification. I can set breakpoints in index.ts and they are hit reliably.

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@FredericLatour yes, I could post sample projects on github for thousand of interesting node.js + something (e.g. Docker) use cases but I'm actually a developer on the VS Code team, not on the Docker team ;-)
I prefer @delfinof's approach: he helped me with a small sample project that showed a problem with source maps in a Docker setup, I fixed a bug in node-debug and now the project can be used an an example that VS Code & Docker & source maps seem to work.
If it doesn't work for you let's try to find out what the difference might be...

@FredericLatour
Copy link

@weinand I see what you mean but at the same time, I can't see hundreds of use-cases involving local/remote stuff with vscode. Besides "editing features", debugging is a hot topic ... And being able to debug "typescript" MS great js superset from another great MS tool "vscode" using current modern dev workflow (docker/vagrant/what else...) seems not even optional to me but I may be biased ...

the docker sample is just an easy way for you (vscode team) to provide a sample that shows explicitly that remode debugging is working both with and without sourcemaps.
It could be a VM as well, but you will have a hard time to provide a VM that can be used as-is whereas a docker config for local/remote debuging can be run in a matter of minutes.

Yes, the @delfinof project is exactly what I was suggesting. However I tried it and it didn't work. But not being published from vscode team, it was hard to say this sample is confirmed to be working on both windows and mac. Moreover, as you can see, the launch config is different between windows (a specific IP address 10.0.75.2) and mac (address = localhost). That's a bit surprising considering that docker for windows works the same way.

Still will retry @delfinof sample ... could have been tired the other day after hundreds of configuration settings changes...

Now if you have someone that has both Windows 10 and docker for windows in your team ... that would be great if this person could give it a try (just need 10 minutes).

Will post back my results .

@tinganho
Copy link
Author

FYI tried on 2 different projects and on 6 occasions. Debugging with breakpoints have never worked for me since VSCode launched. Many hours lost.

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@FredericLatour I suggest that you try to run the docker sample from #2472 on Windows 10 since that seems to be platform where you've experienced the problem (you didn't mention what OS and node version you are using, so I just picked OS X).
If it doesn't work for you then we have a reproducible test case.
And please enable source map tracing by adding this attribute/value to the launch config:

"trace": "sm"

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand Tried on my project. Set sourceMaps to false, removed outDir settings, set localRoot to the dest folder (where I generate typescript or copy js files for those files that are pure js)

{
            "name": "bo-server",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "address": "localhost",
            "restart": true,
            "sourceMaps": false,
            "localRoot": "${workspaceRoot}/build/server",
            "remoteRoot": "/code/build/server"
        },

Now for some reasons, I can breakpoint in pure js files (files copied from src to build folder without transpilation) but not in js files transpiled from typescript. Doesn't make anys sense if you ask me!!

I thought that maybe it was the reference to the sourcemap within the js file:

  • deleted the sourcemap file
  • deleted the reference to the map file in the source
  • did a docker-compose down, then a docker-compose up -d

Still not able to break point in js files that are transpiled from ts. Those things can make you crazy ... Any idea what is happening here?

@FredericLatour
Copy link

@weinand Will now try to run the sample from #2472 again (as you can see in issue thread, I had posted a message indicating that it was not working for me).

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

Sure I've understood that, but you did not try it with "trace": "sm".

@tinganho
Copy link
Author

tinganho commented Aug 15, 2016

Sure I've understood that, but you did not try it with "trace": "sm".

@weinand I don't think I've seen this option before. It is neither in the docs?
https://code.visualstudio.com/docs/editor/debugging#_node-debugging

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@tinganho "trace" is a new internal setting that helps when investigating problems. It is not (yet) an official end user setting.

@FredericLatour please use the "trace" option on your project as well. Watch out for paths where the case of the drive letters doesn't match.

@tinganho
Copy link
Author

@weinand OK, I tried with that option, but it still doesn't work for me. It says cannot find the generated

Breakpoint ignored because generated code not found (source map problem?)

Just curios what outDir setting means? outDir in remote or outDir in local? Tried giving both an absolute path but it still doesn't work.

@FredericLatour
Copy link

@weinand Where am I supposed to get "trace" information?

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

@FredericLatour on the debug console

@tinganho the "trace" option cannot 'fix' anything magically. It just a verbose option for the debugger. Let me know what "trace" prints on the debug console.

@tinganho
Copy link
Author

I got breakpoints working now. You really need to document outDir it should be the "mounted" compiled output directory on local. Even though you compile it on remote. At least, it is how I got it to work. With TypeScript compiled with --inlineSources and --linlineSourceMap I don't think people expect that outDir is even needed?

        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "address": "app.local",
            "restart": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/local",
            "localRoot": "${workspaceRoot}",
            "remoteRoot": "/home/myusername/app"
        },

@tinganho
Copy link
Author

But thanks anyway for the assistent.

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand I don't get anything in the debug console ... not sure what's going on here

    {
        "name": "Attach to docker (win)",
        "type": "node",
        "request": "attach",
        "port": 5858,
        "address": "localhost",
        "restart": false,
        "sourceMaps": true,
        "outDir":"${workspaceRoot}/tssrc",
        "localRoot": "${workspaceRoot}",
        "trace": "sm",
        "remoteRoot": "/mnt"
    },  

@weinand
Copy link
Contributor

weinand commented Aug 15, 2016

what version of VSCode are you using?

@FredericLatour
Copy link

@weinand 1.4
image

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand I really don't get how you get this sample to work immediately. It doesn't even see the ts file in my case:

image

image

@FredericLatour
Copy link

FredericLatour commented Aug 15, 2016

@weinand Moreover, in all honesty, this is not your typical app structure. Transpiled "js" file in the same folder as the typescript folder.. We can never be sure that some side effects are not involved here... With such a configuration localRoot, remoteRoot and outDir settings don't necessarily clarify things.

When I see so many hours, days, posts, frustration, etc ...
Wouldn't it be time for a sample meaningful project that would explain it all.

root nodejs folder (with package.json and so on:
|
|-- src/ : source folder with typescript file
|-- dist/ (or build) : distribution folder - transpiled files and others...
|-- typings/
|-- ...

And now in that case

  • localRoot: ?
  • remoteRoot: ?
  • outDir: ?

What about SourceMap generation: inline, separate files ? Are both supposed to work?

@weinand
Copy link
Contributor

weinand commented Aug 16, 2016

@FredericLatour since you are a Docker professional, it would be great if you could create the "meaningful" (but still minimal) project that has the desired structure and shows how to set things up.
That would be a very constructive contribution to VS Code.

@FredericLatour
Copy link

FredericLatour commented Aug 16, 2016

@weinand I'm far from being a Docker pro. I started to investigate this tech a month ago or so. the basics are really easy to understand. Being able to run the sample on your Macbook makes you as Pro as I can be :)
I was using Vagrant before and had the same problems for remote debugging. It was working with Visual Studio 2013 though because they were using some kind of proxy script for remote debugging.

That would be a very constructive contribution to VS Code.

Hopefuly you are not meaning I'm not constructive by trying desperately to get remote debugging with sourcemaps working or at least trying to know if it is supposed to work which is still not really clear at this time.

I could certainly try to come up with a sample as a starting point but before that can you please:

  1. Can you at least have someone give a try the sample docker based repository on windows 10? Don't tell me nobody uses Windows 10 at MS!!! :) My point is that if someone can make this sample work under windows 10 without any problem, I may not be the best person for creating a meaningful project ;).
  2. Be explicit about the settings that are supposed to be used in a fairly standard situation. Would you mind answering the following:

Considering a fairly standard structure:

root nodejs folder app (with package.json and so on):
|
|-- src/ : source folder with typescript file
|-- dist/ (or build) : distribution folder - transpiled files and others...
|-- typings/
|-- ...

Considering that folder /code in the docker container is mapped to the local root nodejs folder app.

What am I supposed to use for the following settings:

  • localRoot: ...
  • remoteRoot: ....
  • outDir: ...

Are all combination of sourceMaps generation supported? (inline, separate map file)
Do I need to inline the source or it doesn't make any difference?

That would be a good starting point for building a meaningful sample :)

@weinand
Copy link
Contributor

weinand commented Aug 17, 2016

We will put this on the September plan.

@weinand weinand added this to the September 2016 milestone Aug 17, 2016
@FredericLatour
Copy link

@weinand To tell the truth that's a bit beyond me that you still haven't given a try to the sample you mentioned earlier under windows 10.
I mean, in your position, after having run the sample without any problem under Macbook, I would have had some doubts about the guy in the opposite camp ( that is me in this context ) and would have
immediately found a way to give it a try under windows 10 ( in the worst case: 15 minutes install for docker + sample repo cloning + running the sample). Just to be sure the guy (still me) is not just not with it.

Anyway, no other choice than going ahead on my own in the meantime ... and maybe after a thousand of settings, tsc generation and folder structure combinations, I will get it to work by luck.

@weinand
Copy link
Contributor

weinand commented Aug 17, 2016

Hitting TypeScript breakpoints in the unmodified sample works fine on Windows 10 in the VS Code - Insiders.

@FredericLatour
Copy link

@weinand sounds crazy but will restart back from the beginning - cloning the repo and following the instructions in the readme.md.

@FredericLatour
Copy link

@weinand Just tried again and it doesn't work any better. Just trying to understand here.

Can you confirm that unlike what is written in the sample readme.md you had to run "npm run-script dockerdebug" and not just "npm dockerdebug"...

Running docker debug:
image

Setting breakpoints in ts:
image

running debugger with "Attach to docker (win)
As you can see it breaks into the js file (debug-brk) and not ts file.
Moreover ts breakpoints are greyed..

image

This is just crazy that you are able to make this work while I am not ... The steps are easy enough and it's hard to think of anything I would be missing....

@weinand
Copy link
Contributor

weinand commented Aug 17, 2016

Yes, I had to add the run-script flag to npm and I had to enable sharing for my 'C' drive.

@FredericLatour
Copy link

What do you mean by VS Code - Insiders?

@weinand
Copy link
Contributor

weinand commented Aug 17, 2016

@FredericLatour
Copy link

@weinand Could be the reason it doesn't work then?
I posted a screenshot of the vscode version I'm using and you didn't make any comment.

@weinand
Copy link
Contributor

weinand commented Aug 17, 2016

Sure, that could be. I didn't try with 1.4.

@FredericLatour
Copy link

@weinand I had great hope with this insider but it didn't change anything ... the exact same problem...
Now the last think I can think of is that my project is on a "D" drive. Will install it on "C" drive and see.

Question:
When you run the debugger, does it break on the first line right in the "ts" file?

@FredericLatour
Copy link

@weinand It doesn't work any better on the c drive ... this is just insane.
What version of tsc are you using? It should be displayed on the command line when running npm run-script dockerdebug.... (trace=sm doesn't have any effect at all in this situation) ...

This is just getting crazy .... will open another issue and ask to other users if they mind giving it a try ... What do you think?

@FredericLatour
Copy link

@weinand I have looked a bit deeper and I have a hard time to understand how you make this work without any changes ...
The js and map files are generated in the "obj/tsout" folder...
As soon as I copy index.js and index.js.map file, from tsout into tssrc, it works....

Alternatively, I can make it work by:

  1. changing package json dodkerdebug script to point to tsout:
    "dockerdebug": "grunt && dockernode --debug --debug-brk obj/tsout"
  2. changing launch "outDir" config to "outDir":"${workspaceRoot}/obj/tsout"
    Which make sense

Now I'm not really into grunt ... is the grunt file supposed to copy files from tsout to tssrc? If this is the case, it doesn't work on my side.

That said, it seems a bit weird to copy back the generated files .... in the source folder.

@isidorn isidorn modified the milestones: October 2016, September 2016 Sep 30, 2016
@weinand weinand modified the milestones: November 2016, October 2016 Oct 24, 2016
@weinand weinand removed this from the November 2016 milestone Dec 5, 2016
@weinand
Copy link
Contributor

weinand commented May 5, 2017

I just added a "VS Code Recipe" for how to debug transpiled source in Docker with VS Code. Please see https://github.com/weinand/vscode-recipes/tree/master/Docker-TypeScript

@NiceGuyNimni
Copy link

NiceGuyNimni commented Jul 11, 2017

I'm happy to see I'm not alone in the remote-debugging issues area.
I'm new to the process of filing a bug, although I'm not sure it is even a bug yet.

I have a nodejs, babel, webpack 2 server that I try to debug using the remote debugger.
I get all sorts of weird stuff going on, for example:

  1. I can't set breakpoints on valid rows, they become gray.
  2. When I do manage to set a breakpoint it is being hit when I'm not reaching that row.
    For example: I add a breakpoint inside method1 but it is being triggered when I enter method2, like the file I'm seeing is different from the one the remote debugger is seeing.
    And when I step over it jumps a few lines ahead (again, like I'm not seeing the same row as the debugger is seeing).

For the sake of simplicity I'm trying to remote debug using the localhost (although my app is running inside a docker).

Note: I even tried to use the 'show loaded scripts' feature in VSC and add breakpoints inside the loaded script but the problems above still occur.
The only way, for me, to debug is by the --inspector and using the chrome-devtools link.

launch.json

{
"version": "0.2.0",
    "configurations": [
        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
           "port": 5858,
            "address": "localhost",
            "restart": false,
            "sourceMaps": true,
            "localRoot": "${workspaceRoot}",
            "remoteRoot": null,
            "outFiles": ["${workspaceRoot}/**/*.js"],
            "smartStep":true
         }
    ]}

.babelrc

{
	"presets": [
		"es2015-webpack"
	],
	"sourceMaps": true,
	"plugins": [
		"transform-runtime",
		["transform-es2015-modules-commonjs-simple", {
				"noMangle": true
		}],
		[
			"babel-plugin-webpack-alias",
			{
				"config": "./webpack.config.dev.js"
			}
		]
	]
}

webpack.config

import path from 'path';
import fs from 'fs';
import webpack from 'webpack';

export default {
	entry: "./server.js",
	target: 'node',

	externals: fs.readdirSync("node_modules"),
	devtool: 'inline-source-map',

	output: {
		path: path.join(__dirname, "build"),
		filename: "[name].js",
	},

	resolve: {
		extensions: [
			"*",
			".js",
			".json",
		]
	},

	module: {
		loaders: [
			{
				test: /\.js$/,
				exclude: /node_modules/,
				loaders: [
					"babel-loader"
				],
			}
		]
	},
	devServer: {
		contentBase: path.join(__dirname, "api")
	},
	plugins: [
    new webpack.LoaderOptionsPlugin({
      debug: true
    })
  ]
}

Please bear in mind this is the current settings I have after trying multiple solutions shown online, but I'm still stuck with this issue.

Can you please assist @weinand ?

@slavafomin
Copy link

slavafomin commented Oct 10, 2017

Hello there!

I'm having a very hard time trying to setup remote debugging as well.

I have a Node.js application written in TypeScript. I'm using Docker container to transpile and run the application in development environment. I've managed to expose the port and to connect to it with the IDE. However, I can't make breakpoints to work from source TypeScript files. They are just turning grey when I connect to the running app.

  • My project is located on my development machine in /home/sfomin/projects/app,
  • The source files root is ./src,
  • The compiled files are stored in the ./.build/compiled,
  • The root of the project in docker container is: /opt/project, the relative directories are the same,
  • I'm starting the app using this command: node --inspect-brk=0.0.0.0:9229 ./.build/compiled/cli.js.

My launch.json looks like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Node Remote Debug",
            "type": "node",
            "request": "attach",
            "protocol": "inspector",
            "port": 9229,
            "sourceMaps": true,
            "outFiles": [
                "${workspaceRoot}/.build/compiled/**/*.js"
            ],
            "localRoot": "${workspaceRoot}",
            "remoteRoot": "/opt/project",
            "trace": true
        }
    ]
}

Here's example source map file:

{
  "version": 3,
  "sources": [
    "cli.ts"
  ],
  "names": [],
  "mappings": ";;;AAEA,4BAA0B;…",
  "file": "cli.js",
  "sourcesContent": [""]
}

It's referenced like this from the transpiled file: //# sourceMappingURL=cli.js.map.

And here's the part of the debug trace log:

← From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"60","url":"/opt/project/.build/compiled/cli.js","startLine":0,"startColumn":0,"endLine":12,"endColumn":3,"executionContextId":1,"hash":"143694101549CA67BC820764FE83C5E426C38377","isLiveEdit":false,"sourceMapURL":"cli.js.map","hasSourceURL":false,"isModule":false}}
Mapped remoteToLocal: /opt/project/.build/compiled/cli.js -> /home/sfomin/projects/app/.build/compiled/cli.js
SourceMaps.getMapForGeneratedPath: Finding SourceMap for /home/sfomin/projects/app/.build/compiled/cli.js by URI: cli.js.map
SourceMaps.loadSourceMapContents: Reading local sourcemap file from /home/sfomin/projects/app/.build/compiled/cli.js.map
← From target: {"method":"Debugger.paused","params":{"callFrames":[{"callFrameId":"{\"ordinal\":0,\"injectedScriptId\":1}","functionName":"","functionLocation":{"scriptId":"60","lineNumber":0,"columnNumber":10},"location":{"scriptId":"60","lineNumber":0,"columnNumber":10},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":1}"},"startLocation":{"scriptId":"60","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"60","lineNumber":12,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":2}"}}],"this":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":3}"}},{"callFrameId":"{\"ordinal\":1,\"injectedScriptId\":1}","functionName":"Module._compile","functionLocation":{"scriptId":"46","lineNumber":525,"columnNumber":36},"location":{"scriptId":"46","lineNumber":565,"columnNumber":13},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":4}"},"name":"Module._compile","startLocation":{"scriptId":"46","lineNumber":525,"columnNumber":36},"endLocation":{"scriptId":"46","lineNumber":573,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":5}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":6}"}}],"this":{"type":"object","className":"Module","description":"Module","objectId":"{\"injectedScriptId\":1,\"id\":7}"}},{"callFrameId":"{\"ordinal\":2,\"injectedScriptId\":1}","functionName":"Module._extensions..js","functionLocation":{"scriptId":"46","lineNumber":577,"columnNumber":36},"location":{"scriptId":"46","lineNumber":579,"columnNumber":9},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":8}"},"name":"Module._extensions..js","startLocation":{"scriptId":"46","lineNumber":577,"columnNumber":36},"endLocation":{"scriptId":"46","lineNumber":580,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":9}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":10}"}}],"this":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":11}"}},{"callFrameId":"{\"ordinal\":3,\"injectedScriptId\":1}","functionName":"Module.load","functionLocation":{"scriptId":"46","lineNumber":493,"columnNumber":32},"location":{"scriptId":"46","lineNumber":502,"columnNumber":31},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":12}"},"name":"Module.load","startLocation":{"scriptId":"46","lineNumber":493,"columnNumber":32},"endLocation":{"scriptId":"46","lineNumber":504,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":13}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":14}"}}],"this":{"type":"object","className":"Module","description":"Module","objectId":"{\"injectedScriptId\":1,\"id\":15}"}},{"callFrameId":"{\"ordinal\":4,\"injectedScriptId\":1}","functionName":"tryModuleLoad","functionLocation":{"scriptId":"46","lineNumber":462,"columnNumber":22},"location":{"scriptId":"46","lineNumber":465,"columnNumber":11},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":16}"},"name":"tryModuleLoad","startLocation":{"scriptId":"46","lineNumber":462,"columnNumber":22},"endLocation":{"scriptId":"46","lineNumber":472,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":17}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":18}"}}],"this":{"type":"undefined"}},{"callFrameId":"{\"ordinal\":5,\"injectedScriptId\":1}","functionName":"Module._load","functionLocation":{"scriptId":"46","lineNumber":431,"columnNumber":23},"location":{"scriptId":"46","lineNumber":457,"columnNumber":2},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":19}"},"name":"Module._load","startLocation":{"scriptId":"46","lineNumber":431,"columnNumber":23},"endLocation":{"scriptId":"46","lineNumber":460,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":20}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":21}"}}],"this":{"type":"function","className":"Function","description":"function Module(id, parent) {\n  this.id = id;\n  this.exports = {};\n  this.parent = parent;\n  if (parent && parent.children) {\n    parent.children.push(this);\n  }\n\n  this.filename = null;\n  this.loaded = false;\n  this.children = [];\n}","objectId":"{\"injectedScriptId\":1,\"id\":22}"}},{"callFrameId":"{\"ordinal\":6,\"injectedScriptId\":1}","functionName":"Module.runMain","functionLocation":{"scriptId":"46","lineNumber":602,"columnNumber":25},"location":{"scriptId":"46","lineNumber":604,"columnNumber":9},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":23}"},"name":"Module.runMain","startLocation":{"scriptId":"46","lineNumber":602,"columnNumber":25},"endLocation":{"scriptId":"46","lineNumber":607,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":24}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":25}"}}],"this":{"type":"function","className":"Function","description":"function Module(id, parent) {\n  this.id = id;\n  this.exports = {};\n  this.parent = parent;\n  if (parent && parent.children) {\n    parent.children.push(this);\n  }\n\n  this.filename = null;\n  this.loaded = false;\n  this.children = [];\n}","objectId":"{\"injectedScriptId\":1,\"id\":26}"}},{"callFrameId":"{\"ordinal\":7,\"injectedScriptId\":1}","functionName":"startup","functionLocation":{"scriptId":"26","lineNumber":11,"columnNumber":18},"location":{"scriptId":"26","lineNumber":157,"columnNumber":15},"scopeChain":[{"type":"block","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":27}"},"name":"startup","startLocation":{"scriptId":"26","lineNumber":139,"columnNumber":61},"endLocation":{"scriptId":"26","lineNumber":158,"columnNumber":7}},{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":28}"},"name":"startup","startLocation":{"scriptId":"26","lineNumber":11,"columnNumber":18},"endLocation":{"scriptId":"26","lineNumber":203,"columnNumber":3}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":29}"},"startLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"endLocation":{"scriptId":"26","lineNumber":575,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":30}"}}],"this":{"type":"undefined"}},{"callFrameId":"{\"ordinal\":8,\"injectedScriptId\":1}","functionName":"","functionLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"location":{"scriptId":"26","lineNumber":574,"columnNumber":2},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":31}"},"startLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"endLocation":{"scriptId":"26","lineNumber":575,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":32}"}}],"this":{"type":"object","subtype":"null","value":null}}],"reason":"Break on start","hitBreakpoints":[]}}
Paused on entry
→ To target: "{\"id\":9,\"method\":\"Runtime.evaluate\",\"params\":{\"expression\":\"[process.pid, process.version, process.arch]\",\"returnByValue\":true,\"contextId\":1}}"
→ To target: "{\"id\":10,\"method\":\"Runtime.evaluate\",\"params\":{\"expression\":\"[process.pid, process.version, process.arch]\",\"returnByValue\":true,\"contextId\":1}}"
To client: {"seq":0,"type":"response","request_seq":2,"command":"attach","success":true}
← From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"62","url":"","startLine":0,"startColumn":0,"endLine":0,"endColumn":44,"executionContextId":1,"hash":"22960EE2CC885872F71ED2E747A68B200282CC65","isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":false}}
← From target: {"id":9,"result":{"result":{"type":"object","value":[60,"v8.1.2","x64"]}}}
Target node version: v8.1.2 x64
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"nodeVersion","data":{"version":"v8.1.2"}}}
SourceMaps: expanded globs and found 398 scripts
From client: loadedSources(undefined)
← From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"63","url":"","startLine":0,"startColumn":0,"endLine":0,"endColumn":44,"executionContextId":1,"hash":"22960EE2CC885872F71ED2E747A68B200282CC65","isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":false}}
← From target: {"id":10,"result":{"result":{"type":"object","value":[60,"v8.1.2","x64"]}}}
To client: {"seq":0,"type":"response","request_seq":3,"command":"loadedSources","success":true,"body":{"sources":[{"name":"cli.js","path":"/opt/project/.build/compiled/cli.js","sourceReference":1034,"origin":"read-only content from Node.js"},{"name":"VM62","path":"<eval>/VM62","sourceReference":1035,"origin":"read-only content from Node.js"},{"name":"_stream_duplex.js","path":"<node_internals>/_stream_duplex.js","sourceReference":1030,"origin":"read-only core module"},{"name":"_stream_passthrough.js","path":"<node_internals>/_stream_passthrough.js","sourceReference":1032,"origin":"read-only core module"},{"name":"_stream_readable.js","path":"<node_internals>/_stream_readable.js","sourceReference":1026,"origin":"read-only core module"},{"name":"_stream_transform.js","path":"<node_internals>/_stream_transform.js","sourceReference":1031,"origin":"read-only core module"},{"name":"_stream_writable.js","path":"<node_internals>/_stream_writable.js","sourceReference":1029,"origin":"read-only core module"},{"name":"assert.js","path":"<node_internals>/assert.js","sourceReference":1010,"origin":"read-only core module"},{"name":"async_hooks.js","path":"<node_internals>/async_hooks.js","sourceReference":1009,"origin":"read-only core module"},{"name":"bootstrap_node.js","path":"<node_internals>/bootstrap_node.js","sourceReference":1000,"origin":"read-only core module"},{"name":"buffer.js","path":"<node_internals>/buffer.js","sourceReference":1003,"origin":"read-only core module"},{"name":"events.js","path":"<node_internals>/events.js","sourceReference":1001,"origin":"read-only core module"},{"name":"fs.js","path":"<node_internals>/fs.js","sourceReference":1023,"origin":"read-only core module"},{"name":"buffer.js","path":"<node_internals>/internal/buffer.js","sourceReference":1006,"origin":"read-only core module"},{"name":"errors.js","path":"<node_internals>/internal/errors.js","sourceReference":1005,"origin":"read-only core module"},{"name":"fs.js","path":"<node_internals>/internal/fs.js","sourceReference":1033,"origin":"read-only core module"},{"name":"linkedlist.js","path":"<node_internals>/internal/linkedlist.js","sourceReference":1008,"origin":"read-only core module"},{"name":"module.js","path":"<node_internals>/internal/module.js","sourceReference":1021,"origin":"read-only core module"},{"name":"process.js","path":"<node_internals>/internal/process.js","sourceReference":1011,"origin":"read-only core module"},{"name":"next_tick.js","path":"<node_internals>/internal/process/next_tick.js","sourceReference":1013,"origin":"read-only core module"},{"name":"promises.js","path":"<node_internals>/internal/process/promises.js","sourceReference":1014,"origin":"read-only core module"},{"name":"stdio.js","path":"<node_internals>/internal/process/stdio.js","sourceReference":1015,"origin":"read-only core module"},{"name":"warning.js","path":"<node_internals>/internal/process/warning.js","sourceReference":1012,"origin":"read-only core module"},{"name":"querystring.js","path":"<node_internals>/internal/querystring.js","sourceReference":1017,"origin":"read-only core module"},{"name":"BufferList.js","path":"<node_internals>/internal/streams/BufferList.js","sourceReference":1027,"origin":"read-only core module"},{"name":"destroy.js","path":"<node_internals>/internal/streams/destroy.js","sourceReference":1028,"origin":"read-only core module"},{"name":"legacy.js","path":"<node_internals>/internal/streams/legacy.js","sourceReference":1025,"origin":"read-only core module"},{"name":"url.js","path":"<node_internals>/internal/url.js","sourceReference":1016,"origin":"read-only core module"},{"name":"util.js","path":"<node_internals>/internal/util.js","sourceReference":1004,"origin":"read-only core module"},{"name":"module.js","path":"<node_internals>/module.js","sourceReference":1020,"origin":"read-only core module"},{"name":"path.js","path":"<node_internals>/path.js","sourceReference":1019,"origin":"read-only core module"},{"name":"querystring.js","path":"<node_internals>/querystring.js","sourceReference":1018,"origin":"read-only core module"},{"name":"stream.js","path":"<node_internals>/stream.js","sourceReference":1024,"origin":"read-only core module"},{"name":"timers.js","path":"<node_internals>/timers.js","sourceReference":1007,"origin":"read-only core module"},{"name":"util.js","path":"<node_internals>/util.js","sourceReference":1002,"origin":"read-only core module"},{"name":"vm.js","path":"<node_internals>/vm.js","sourceReference":1022,"origin":"read-only core module"}]}}
SourceMap: creating for /home/sfomin/projects/app/.build/compiled/cli.js
SourceMap: sourceRoot: undefined
SourceMap: sources: ["cli.ts"]
SourceMap: no sourceRoot specified, using script dirname: /home/sfomin/projects/app/.build/compiled
SourceMaps.scriptParsed: /home/sfomin/projects/app/.build/compiled/cli.js was just loaded and has mapped sources: ["/home/sfomin/projects/app/.build/compiled/cli.ts"]

If I place breakpoints inside of transpiled JS files (in /.build/compiled directory), opened in the editor, they are working fine. I guess it means that localRoot and remoteRoot options are configured correctly. However, breakpoints in source files are just ignored.

How do I make it to work? I think I'm missing something trivial here.

Any suggestions will be highly appreciated! Thank you!

@lironess
Copy link

lironess commented Feb 5, 2018

also happens for me, when my launch.json looks like:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Node: Nodemon",
      "port": 9229,
      "address": "localhost",
      "restart": true,
      "protocol": "inspector",
      "remoteRoot": null,
      "sourceMaps": true,
      "localRoot": "${workspaceRoot}/"
    }
  ]
}

I'm running nodemon with babel-node. When I put a debugger, it opens a new file (with the precompiled ES6 as expected) with this title:
image
but breakpoints are being completely ignored.
any help?

@weinand
Copy link
Contributor

weinand commented Feb 5, 2018

@lironess since you are leaving the "remoteRoot" undefined, your setup is no remote setup.
Please create a new issue.

@esetnik
Copy link

esetnik commented Mar 21, 2018

@slavafomin did you ever figure this out? I have the same issue in the latest stable version 1.21.1

@bpasero bpasero removed the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Oct 8, 2019
@weinand
Copy link
Contributor

weinand commented Oct 16, 2019

With the appearance of the VS Code Remote Development Pack this problem has become obsolete.

@weinand weinand closed this as completed Oct 16, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

10 participants