-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
source maps are not working when debugging with chrome #8369
Comments
Yep, this is a known limitation and it's not something that we can actually fix at this time. The issue is that the chrome debugger needs to know how to fetch the original source but the inspector code has no way of providing it yet. |
@jasnell How so? The sourcemap in this example is inlined. Isn't the data from the sourcemap sufficient? Sourcemaps in the browser can show the original source without having access to the actual files. |
poke @jasnell |
Ping |
/cc @nodejs/v8-inspector |
Any solution here guys? @jasnell @matthewoates |
hmm... I thought I had responded to this earlier today. Perhaps it got lost somewhere and will show up on wikileaks someday... in any case, there's no solution at this time. Source maps are not supported when using the chrome inspector with node because there is no mechanism by which to locate and load those source maps. We would need some one to figure out how to make it work and open a PR. |
Source maps aren't supported at the current time because there's no On Friday, October 21, 2016, Samuel Castro [email protected] wrote:
|
@jasnell - can you give some technical background/pointers on what's going on here? I'll happily try to help out if I can get a bit of direction. Isn't this just stock Chrome DevTools UI integrating with node's debugging protocol exposed via v8-inspector? Chrome's DevTools support sourcemap loading already for frontend work, and the context menu option to "Add Source Map" exists when you right-click on the code pane. It seems non-functional though. Unfortunately, a ton of people are using Babel/Typescript transpilation for node, and lack of sourcemaps leaves --inspect functionality severely hampered. @pavelfeldman indicated in a couple places that they should work: |
I'm chipping in because I've been a bit confused by this, and see no reason it shouldn't work given what's presented in Chrome.
I'm using When I click "more" this is the message: If Chrome can both detect an inline source map and knows the path to my source, shouldn't this be able to work? Debugging seems to work pretty much fine otherwise, other than a bug with the console sometimes not working correctly. As an aside: I know it's probably not comparable, but I recently gave VS Code a go using the new Node debugger (referred to as |
This comment has been minimized.
This comment has been minimized.
If you guys are opening the inspect link in Chrome, then I think they won't work because a webpage has no way of accessing the disk, right? Typically chrome devtools is run in a host that provides access to the disk and other things. Probably would work from the |
@robertchiras see my first comment. You don't need to access the filesystem for source maps to work. |
IIRC the problem is that Devtools wants to resolve all URLs (including So my best guess is that the place to fix it would be the devtools frontend, potentially adding a special case there for data urls..? |
Possible duplicate on the devtools side: https://bugs.chromium.org/p/chromium/issues/detail?id=664801&q=component%3APlatform%3EDevTools%20node&colspec=ID%20Owner%20Summary%20Modified%20Stars |
This appears to be fixed in Node 7.2.1 and Canary. Can anyone else confirm? |
@joshunger Node 7.2.1 and Canary did not resolve the issue for me. A workaround is to host the source map file... Example: |
@joshunger This is working for me now with Node 7.2.1 & Canary (Version 57.0.2962.0 (Official Build) canary (64-bit) ) |
Confirmed 😄 It's working here with Node 7.3.0 and Canay Version 57.0.2963.0 |
I may have been on an older version of Canary when I tried this earlier. I can confirm that this does work for me as well with |
Looks like Firefox's https://github.com/devtools-html/debugger.html/ works with Node 6 if you want to compare debuggers. |
Is there anyway to open up the chrome debug link automatically rather than copying and pasting everytime? |
@RanjithNair Latest chrome exposes it directly in the devtools as an experiment, generally you can have "chrome://inspect" open and a link you can click will just pop up. |
@eugeneo , @s3ththompson: when do we remove auto-attach from behind experiments in Chrome? |
I can confirm that it is currently working on my side with the following setup:
Steps to reproduce:
Confirmed not working with npm 3.10.10 & node 6.11.3 |
@kevinsimper have you attempted to map the ports of your docker container to the localhost? |
the npm script should look something like this
|
I spoke too soon, the source map only works for the entry file (index.js), but not for any other files linked by the index file :( Any other file is simply not imported. |
Platform: win10 Chrome Canary Version 64.0.3250.0 (Official Build) canary (64-bit) Sourcemaps don't work for me either for a simple typescript project. I had a coworker install the same project on his mac and the source maps work just fine... |
The issue on chromium has been closed with the following comment:
|
How though? I remember when I last looked at this passing a source map URL with cc @eugeneo |
Nifty update from my side! ✨ ✨ ✨
It works 😱 |
Thanks to @fauverism pointing to this stack overflow link the problem was easily solved for me. |
From some tests performed on source-maps I could state that currently they work on MacOS and Linux on Chrome both systems. Unfortunately on Windows Systems (Windows 10) I can't get it to work. On top of that I tried loading the source-maps from the filesystem and from a Simple HTTP server with no success. MacOS
Linux
Windows
Anyone can confirm or check this? |
Just a time saver for anyone who might have been in the same boat as me-- the Node.js V8 --inspector Manager (NiM) seems to introduce this issue when it otherwise wouldn't be present-- I spent about an hour banging my head before disabling the Chrome plugin and discovering that everything worked fine when opening from |
So that we can generate a big module string which can be generated at build-time and saved to disk. This is important for two reasons: 1. This allows the browser to avoid using scion compiler at runtime. Compiled SCXML-to-js modules are much smaller runtime dependency over the wire than the SCION compiler. 2. Node.js --inspect does not work for code evaluated at runtime using eval or node vm module. See issue nodejs/node#8369. So to use chrome dev tools and source maps to debug SCXML, it is currently necessary to use ahead-of-time compilation to generate a module file as a workaround.
@anied thank you so much. I spent hours reading github posts, tweaking the settings of |
Seems to be working on macOS and Linux, but not on Windows. However, for Windows, there's an issue at #10838. So I'm going to close this. However, if I'm wrong to do that, leave a comment. Just doing some tidying around the issue tracker.... |
@Trott Closing the bug because it's being partially blocked by another bug doesn't really make sense for me. The blocking bug could be easily fixed by recoding Windows-style file paths to Unix-style (required API is generously provided by Node's library), but it is not fixed as to enforce enough rage in users to go into Chromium's bugtracker and sign upstream bug there. I don't really think this is a community-friendly behavior. We already have an example of |
FWIW, I closed it because I'm under the impression that the remaining issue is actually caused by that bug, not because a fix is partially blocked by that bug. |
Yes, the issue is that Chrome mixed up paths and URLs, but in the end only the fact that source maps are not working is important. Even though it's theoretically correct to fix it in the browser, it's impractical to wait for it, because it won't. |
It's been fixed in devtools (diff) so I'm going to go ahead and close this out. |
It still not working sometimes. |
While using |
I am debugging my mocha tests using native node debugger, using the following command:
Debugger works great, but I cannot make source maps to work.
I created a small simple example here.
Just clone +
npm i
+npm run test-debug
. You'll see that when opening the address from command line (chrome-devtools://devtools....) you can debug but source maps are not working:I tried adding project to workspace / adding source maps manually with no luck. Am I doing something wrong here? Is there an issue here?
The text was updated successfully, but these errors were encountered: