vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

URL breakpoints don't bind on Node 8

Open Muhammad406 opened this issue 1 year ago • 17 comments

I am trying to use debugger for a Dockerized Node Typescript project. I set the breakpoints to the lines where i wish to debug the code but the breakpoint doesnt bind. Basically the breakpoint changes from solid red to outlined grey. I have set the port and exposed it in both dockerfile and docker compose.

This is my start script: "start": "node -r source-map-support/register ./node_modules/.bin/nodemon --inspect=0.0.0.0:9229 ./build/server.js",

This is my launch.json :

{ "version": "0.2.0", "configurations": [ { "name":"sphinx-api", "type": "node", "request": "attach", "restart":true, "port":9229, "localRoot": "${workspaceFolder}/sphinx-api", "remoteRoot": "/api", "trace": true, "resolveSourceMapLocations": [ "${workspaceFolder}/**", "!**/node_modules/**" ], } ] }

This is my tsconfig.json file: { "compileOnSave": true, "compilerOptions": { "lib": ["es2015","es2016","es2017"], "suppressImplicitAnyIndexErrors": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "moduleResolution": "node", "noImplicitReturns": false, "noEmitOnError": true, "strictNullChecks": true, "traceResolution": false, "noUnusedLocals": true, "noUnusedParameters": false, "noImplicitAny": true, "alwaysStrict": true, "strict": true, "module": "commonjs", "outDir": "./build", "baseUrl": "./src", "target": "es2017", "inlineSourceMap": true, "allowJs": true, "pretty": true, }, "include": [ "./package.json", "./tsconfig.json", "./src/**/*" ], "paths": { "src/*" : ["./src/**/*"] }, "types": [ "@types/underscore" ] }

Below I have attached the images of Debugger getting attached and troubleshooting log of unbound breakpoint. I am not sure why is it not setting and the code executes but it doesnt stop at breakpoint. It was working fine 3 4 days back.

Any help would be appreciated.

vs code version: 1.83 Node version: 8.9.4 Typescript version: 2.6.2

Screenshot 2023-10-16 at 11 15 28 PM

Screenshot 2023-10-16 at 11 15 49 PM

Screenshot 2023-10-16 at 11 16 36 PM

Muhammad406 avatar Oct 16 '23 18:10 Muhammad406

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to [email protected]

connor4312 avatar Oct 16 '23 18:10 connor4312

Also, your Node version is ancient (end of life was almost 4 years ago) and has known issues. You may want to upgrade at some point.

connor4312 avatar Oct 16 '23 18:10 connor4312

@connor4312 we are currently running this project on production, so wont be able to migrate as of this point. I have shared the log file to your email.

Muhammad406 avatar Oct 16 '23 19:10 Muhammad406

It looks like this bug is due to differing behavior in the version of V8 included with Node 8. Its "URLs" are actually paths like "/api/foo/bar.js" instead of "file:///api/foo/bar.js".

connor4312 avatar Oct 16 '23 19:10 connor4312

@connor4312 Meanwhile is there a way around that i can use to get on with the debugger?

Muhammad406 avatar Oct 16 '23 19:10 Muhammad406

You can install the nightly version of the debugger, right click and pick "Install Another Version", and then install an older version. Versions <=2023.8.* should work for you.

connor4312 avatar Oct 17 '23 15:10 connor4312

works like charm! Thanks

Muhammad406 avatar Oct 17 '23 18:10 Muhammad406

Greetings @connor4312 , I've the exact same problem (debugger not working w/ node 8). I've installed <=2023.8.* (even went back to 2019.11.*) but still not working. Any alternatives?

federico-r-figueredo avatar Oct 20 '23 04:10 federico-r-figueredo

Greetings, any updates on this one?

federico-r-figueredo avatar Oct 30 '23 14:10 federico-r-figueredo

If <=2023.8.* does not work, you are hitting a different issue. Please create a new issue in this repo using the template. Though I strongly recommend upgrading Node.js first to see if the problem goes away, as there are many known issues with Node 8.

connor4312 avatar Oct 30 '23 14:10 connor4312

Upgrading node fixes it. But our project is still in node 8 and this extensions declares that minimum supported version is node 8.x. Should the min. supported version of vscode-js-debug be updated then to reflect which engines it supports? Or the incompatibility w/ the node 8 will be fixed?

federico-r-figueredo avatar Nov 08 '23 23:11 federico-r-figueredo

@connor4312 the nightly version isn't working now either. Any update on this?

Muhammad406 avatar Dec 11 '23 17:12 Muhammad406

Greetings @connor4312 . Any updates on this one?

federico-r-figueredo avatar Dec 12 '23 00:12 federico-r-figueredo

Greetings @connor4312 . Any updates on this one? I know the current supported version is node 8.x. If a fix on this issue is not planned to be delivered, should the lowest supported version of the extension be updated the lowest that actually works?

federico-r-figueredo avatar Dec 20 '23 11:12 federico-r-figueredo

Greetings @connor4312 . Any updates on this?

federico-r-figueredo avatar Dec 28 '23 21:12 federico-r-figueredo

Greetings @connor4312 , any updates on this?

federico-r-figueredo avatar Jan 13 '24 12:01 federico-r-figueredo

Greetings @connor4312 , any updates on this?

federico-r-figueredo avatar Feb 11 '24 04:02 federico-r-figueredo

I don't plan to fix this. Node 8's reached its end of life date over 5 years ago, there many limitations to its debugging functionality, and practically there are a miniscule number of users still on it. Newer and supported LTS releases have been available for 6 years.

If you need to debug in Node 8, I recommend switching back to a much older nightly release. This debugger was released shortly after Node 8 hit end of life at which time we had decent support for it.

connor4312 avatar Aug 01 '24 22:08 connor4312