9 comments
 
right now I hav no idea what's going on...
I can only say that remote debugging with sourcemaps only works if sources are inlined. Can you check if debugging works when using sourcemaps.write(".", includeContent: true })?
 
 
0

Have been unable to recreate the issue in my environment.

Sample project: ftp://ftp.intellij.net/pub/.idea/test_project/expressES6.zip

Dockerfile:

```FROM node:boron

RUN npm install -g gulp-cli

WORKDIR /opt/project

COPY package.json /opt/project/

RUN npm install

COPY . /opt/project

EXPOSE 5858

CMD ["npm", "start"]```

 

Application is started with NPM script:

```

"scripts": {

"start": "node node_modules/gulp/bin/gulp.js --gulpfile gulpfile.js nodemon"

}

```

 

- Place Dockerfile in the example project.

- Build image:

```docker build -t my-node-gulp-project .```

- Run image:

```docker run -p 5858:5858 -d my-node-gulp-project```

- Start Node.js Remote on the disposed port (in my case: 192.168.99.100:5858) and check Debug.

 

Breakpoints in \src\routes\users.js are correctly hit

 

Can you check if you can repeat the issue using my project?

0

This one works fine... even if I use docker for windows. The question is why the other one does not work. Could you take a look at https://github.com/JustMarriedTeam/JustMarriedServer. It can be easily run using docker-compose up command and then attach to ping.js file inside handlers directory. Debugger port is the default one 5858. As of now that attach sources is turned off but if you turn it on it doesn't work either.

 

Thanks!

0

tried running it locally first... after setting all environment variables, still can't make it work because of `Error: Cannot find module 'sleep'`

 

Anyway, i can see that the generated sourcemaps are wrong: the path to ping.js resolved from generated sourcemap is `<app-root>/build/src/main/handlers/ping.js` instead of expected `<app-root>/src/main/handlers/ping.js`

0

Hm yeah but the source map itself has

"sourceRoot":"../../src"
"sources":["main/handlers/ping.js"]

So it should be fine? Anyway if the source root is set to absolute value it doesn't work either...

0

it's not - `../../` from build/main/handlers folder is 'build', so the resulting path is `build/src/main/handlers/ping.js`

try changing sourceRoot in mainCompile task to

sourceRoot: "../src"

 

0

I think I already tried it but I checked and doing that made ping.js.map have

"sourceRoot":"../../../src"

So it should point to 'src/main/handlers/ping.js.

But still I cannot hit the breakpoint.

 

The complete map.js.map would be

 

{"version":3,"sources":["main/handlers/ping.js"],"names":["module","exports","get","req","res","status","OK","json","text"],"mappings":";;AAAA;;;;;;AAEAA,OAAOC,OAAP,GAAiB;AACfC,KADe,eACXC,GADW,EACNC,GADM,EACD;AACZA,QAAIC,MAAJ,CAAW,qBAAWC,EAAtB,EAA0BC,IAA1B,CAA+B;AAC7BC,YAAM;AADuB,KAA/B;AAGD;AALc,CAAjB","file":"ping.js","sourcesContent":["import HttpStatus from \"http-status\";\n\nmodule.exports = {\n  get(req, res) {\n    res.status(HttpStatus.OK).json({\n      text: \"Hi there!\"\n    });\n  }\n};\n"],"sourceRoot":"../../../src"}
0

Ok. Anyway, sources have to be inlined to make remote debugging work.

Can you provide instructions on running your app? Still can't start it because of `Error: Cannot find module 'sleep'`

0

Can it be run via docker-compose up or it doesn't work too? That might give us some clues.

0

Please sign in to leave a comment.