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

support chome devtools #1120

Closed
ry opened this issue Oct 30, 2018 · 43 comments · Fixed by #4484
Closed

support chome devtools #1120

ry opened this issue Oct 30, 2018 · 43 comments · Fixed by #4484

Comments

@ry
Copy link
Member

ry commented Oct 30, 2018

V8 has extensive debugging abilities built-in.
This is what allows Node to connect to Chrome inspector for debugging.

The behavior of node --inspect --debug-brk script.ts is usually the behavior people want - which is start V8Inspector and break on line 1 of the main script. In deno, I'd like to shorten this to deno script.ts --debug.

This is a large feature which will probably require several passes. The core binding to V8Inspector should be done in libdeno.

@dsseng
Copy link
Contributor

dsseng commented Feb 1, 2019

We can also make a VS Code extension based on Chrome debugger to debug with Deno easily!

@ry ry added this to the future milestone Feb 5, 2019
@ry ry changed the title deno --debug support chome devtools Jun 3, 2019
@ry ry mentioned this issue Jun 7, 2019
43 tasks
@oldrich-s
Copy link

I would just add that I use both debug and debug-brk in Node.js.

Often I start an application with debug flag to be later on able to easily hook into it if necessary.

@Fenzland
Copy link
Contributor

Maybe console.log should not print anything without --debug. That's designed to log things on devtool rather than user view. For stdout outputting, we have Deno.stdout.write already.

@kitsonk
Copy link
Contributor

kitsonk commented Jun 17, 2019

There is a lot of code that expects console.log() to write to stdout. Changing that behaviour would surprise a lot of people. I would be 👎 for changing that.

@Fenzland
Copy link
Contributor

@kitsonk Thank you for your attentions. Break changes are not welcome. But it's not too late to discuss ideas like this until 1.0 is released. One goal of deno is 'not explicitly compatible with Node', but make better designs. I think make clear between debugging and stdout is helpful for this.

@kitsonk
Copy link
Contributor

kitsonk commented Jun 18, 2019

I still don't think it is a better design.

@hayd
Copy link
Contributor

hayd commented Jun 18, 2019

console.log not printing to stdout is a separate issue. This issue is about debugging with V8Inspector .

@jimmont
Copy link

jimmont commented Jun 20, 2019

unless using a redirect mechanism, expecting clear relationships:

console.log == stdout
console.error == stderr
console.warn == stderr

so that with a way to redirect (and it's not because Nodejs has this)

@NamPNQ
Copy link

NamPNQ commented Jun 20, 2019

@Fenzland Please create another issue or just start discuss in gitter

@jpike88
Copy link

jpike88 commented Jun 27, 2019

Is it possible to maintain backwards compatibility with the existing vscode extension?

@NamPNQ
Copy link

NamPNQ commented Jun 27, 2019

@jpike88 what the vscode extension you mention?

@jpike88
Copy link

jpike88 commented Jun 27, 2019

@jpike88
Copy link

jpike88 commented Jun 27, 2019

A Deno debug session is basically a node debug session with TS source maps built in. Why not just directly route through to the v8 process, and inform it correctly with virtual/inline source maps or something?

@mtharrison
Copy link
Contributor

The vscode debugger is just another frontend (like devtools), we need to write the integration with Deno and the backend V8. Once that's done, you should be able to use vscode debugger too.

@Extarys
Copy link

Extarys commented Jun 27, 2019

Is there a Firefox extension that would allow/emulate Google devtools using deno --debug with it? I don't use Google products :O

@jpike88
Copy link

jpike88 commented Jun 27, 2019

Technically v8 isn’t a google product in the sense you’re probably thinking, only Chrome is. You won’t have any data sent or collected by google when using something like demo (or Nodejs, which also uses v8).

@Extarys
Copy link

Extarys commented Jun 28, 2019

I was talking more about being "forced" of using a Chrome-based browser to debug a Deno app. But if we can debug directly in VS Code... then I'm fine.

@kitsonk
Copy link
Contributor

kitsonk commented Jun 30, 2019

Which of course VSCode is an Electron App which is based on Chromium/Node.js and runs V8. 🤷‍♂

@Extarys
Copy link

Extarys commented Jul 2, 2019

I know 😢 But I still refuse to use any chrome-based browsers. Technically, VSCode is not a browser.... (well... anyway 😆 )

@kitsonk
Copy link
Contributor

kitsonk commented Jul 2, 2019

Yeah, I guess you shouldn't then ever look under the help menu in VSCode.

Help_and_Menubar

Developer_Tools_-_file____Applications_Visual_20Studio_20Code_app_Contents_Resources_app_out_vs_code_electron-browser_workbench_workbench_html_config__7B_22__22_3A_5B_22_2FUsers_2Fkkelly_2Fgithub_2Fnocuous_22_5D_2C_22appRoot_22_3A_22_2FAppl

@jpike88
Copy link

jpike88 commented Jul 2, 2019

Just to be pedantic:

chrome-based

You mean chromium-based. Google Chrome is chromium + Google's services

@Extarys
Copy link

Extarys commented Jul 2, 2019

@jpike88 Yes. Still, Chromium is developed by Google, mostly.

@kitsonk I do know what an electron app is 😉 ...
I still refuse to browse the web using chromium based browsers.

@flying-sheep
Copy link
Contributor

We’re talking about the v8 inspector protocol here right?

VS Code and Chrome/Chromium devtools support this, anything else?

@flovilmart
Copy link

Is it actively worked on by s/o? Would be interested to chip in.

@brandonkal
Copy link
Contributor

If anyone needs an interim solution, here is how I am debugging Deno programs in Node right now: brandonkal/deno-lib@37b44f1

@quantuminformation
Copy link

thanks @brandonkal chrome debugging is defo what I need.

@Soremwar
Copy link
Contributor

Hey guys, something caught up my attention while reading about Node's debugging environment.

From Node's official documentation

node_debugger_security_issues

How much of Deno's security system is applied in behalf of the debugger? Should we specify access flags for the debugger as well?

@kitsonk
Copy link
Contributor

kitsonk commented Jan 30, 2020

The debugger would not be able to elevate the Deno permissions, as all access is through the Rust ops. You can still run arbitrary code over the debug port, but only with the permissions that have been given to that workload. Leaving a debug port open in production is still a "bad" idea.

@bnoordhuis
Copy link
Contributor

Is anyone actively working on this, e.g., @bartlomieju? I have some spare cycles next week (if I my kids don't get sick again ^^) and I have a pretty good idea on how to attack this.

@bartlomieju
Copy link
Member

@bnoordhuis currently @ry is working on devtools

@ozanmuyes
Copy link

ozanmuyes commented Mar 19, 2020

Thank you for deno, I should say that first. Any news on this issue?

@brandonkal
Copy link
Contributor

@ozanmuyes The issue will be closed when there is news.

@ry
Copy link
Member Author

ry commented Mar 19, 2020

It's on my queue, I will resume work soon.

@ozanmuyes
Copy link

@ry Awesome, thanks. Sorry for the question if its improper on these "pandemic" days, I just realize. Even though I wasn't expected such a quick response, impressed.

@KSXGitHub
Copy link
Contributor

Leaving a debug port open in production is still a "bad" idea.

It is convenient however. Imagine being able to fix some bugs temporarily without user waiting for new version to be developed and deployed. If we can set password to access remote debugger, would it still be a bad idea?

@kitsonk
Copy link
Contributor

kitsonk commented Mar 24, 2020

If we can set password to access remote debugger, would it still be a bad idea?

Distributing code with backdoors... 😱

@KSXGitHub
Copy link
Contributor

Distributing code with backdoors...

I was talking about web server, not code that runs on user's machine.

@brandonkal
Copy link
Contributor

I was talking about web server, not code that runs on user's machine.

You are describing embedding a backdoor in a production web server. That's something you just don't do. How would you like it being in a checkout flow knowing a developer or bad actor with a password can monitor and alter your request and response? That's a very very bad idea.

@jpike88
Copy link

jpike88 commented Mar 24, 2020

Simple, just put it behind a flag. If you want the debug port open, set a flag. It’s how node works.

@brandonkal
Copy link
Contributor

That is what was proposed here with the--debug flag. It would listen on the local interface only.

@Soremwar
Copy link
Contributor

Soremwar commented Mar 24, 2020

@jpike88 I've done that. In the the two month time span that backdoor was in production (open to me so I could monitor a highly experimental feature) I was so close to have a mental breakdown out of stress.

Literally, if they ever noticed about that, I would have lost my job in the blink of an eye, and maybe even losing my reputation in the process.

Test your software, don't deliver unfinished or experimental products. And for love of god don't leave backdoors open.

@kitsonk
Copy link
Contributor

kitsonk commented Mar 24, 2020

I was talking about web server, not code that runs on user's machine.

There are secure patterns for production observability that do not require leaving backdoors running on your production servers.

@ry ry mentioned this issue Mar 27, 2020
@ry ry closed this as completed in #4484 Mar 27, 2020
@vegerot
Copy link
Contributor

vegerot commented May 22, 2020

I would just add that I use both debug and debug-brk in Node.js.

Often I start an application with debug flag to be later on able to easily hook into it if necessary.

So in that case the question is should the default behavior be to break at start, and add another flag to not break, or the other way around like Node does it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.