question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with launching debug

See original GitHub issue

@kitsonk Certainly; no problem.

It is still not working for me. I am still experiencing the same result as in my previous comment: https://github.com/denoland/vscode_deno/issues/12#issuecomment-737553932

Here is some additional information:

When I have no .vscode/launch.json config and simply press F5 (run the debugger), I am presented with a list of choices. I choose the one named “Deno: Run”. After waiting several seconds, I receive this error dialog:

vscode-deno-debug-error

If I then create a custom launch config file, I can get further in the debug process, but only to the point described in my previous comment.

For comparison, here are multiple debug configs, commented to explain their sources:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Deno (from extension)", // generated by using "Add configuration... > Deno: Run"
      "type": "pwa-node",
      "request": "launch",
      "program": "${workspaceFolder}/main.ts", // it seems "main.ts" is assumed, but the file might not exist
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": [
        "run",
        "--inspect=127.0.0.1:9229",
        "--allow-all" // unsafe default
      ],
      "attachSimplePort": 9229
    },
    {
      "name": "Deno (from manual)", // from https://deno.land/manual@v1.8.3/getting_started/debugging_your_code#vscode
      "type": "pwa-node",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": ["run", "--inspect-brk", "-A", "${file}"], // unsafe default permissions
      "attachSimplePort": 9229
    },
    {
      "name": "Deno (custom)", // manually created
      "type": "pwa-node",
      "request": "launch",
      "program": "${file}",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": [
        "run",
        "--inspect-brk"
      ],
      "attachSimplePort": 9229
    }
  ]
}

I ran this test again today on WSL, but haven’t tested again on macOS yet.

Here is a zip file containing the workspace folder used when I did this test before posting this comment:

debug-example.zip

Env:

$ deno --version
deno 1.8.3 (release, x86_64-unknown-linux-gnu)
v8 9.0.257.3
typescript 4.2.2

$ code --version
1.55.0
c185983a683d14c396952dd432459097bc7f757f
x64

$ code --list-extensions --show-versions | grep "deno"
denoland.vscode-deno@3.2.0

_Originally posted by @jsejcksn in https://github.com/denoland/vscode_deno/issues/12#issuecomment-813760294_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
kitsonkcommented, Aug 30, 2021

There are several different issues occurring here.

We didn’t have a very intelligent “default” debug configuration, nor did the code that created a launch.json work correctly in a lot of environments/situations. #513 should have fixed that.

We changed the default from --inspect-brk to --inspect because some people felt it better default, but then in that case, if you code doesn’t await for a request, or you don’t have a breakpoint test, it just exits. I will try to improve the documentation around debugging to make these clear.

For now I am going to close this issue, and once #513 is released, if there are still issues, I would encourage people to open a new issue so it can be investigated, as this issue has several root causes going on.

3reactions
sapradhancommented, Jun 28, 2021

The debug error is about as useless to me too. It appears deno exits 1 too fast for it to recognize there is a breakpoint. --inspect-brk seems to help at least vs --inspect.

I can confirm --inspect-brk works for me on Deno 1.11.2.

My observation was that --inspect worked a few times then I started getting Could not connect to debug target (possibly after forcefully terminating debug session by pressing the stop button)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Unable to Start Debugging on the Web Server
Make sure the server's web.config includes debug=true in the compilation element. Make sure that your Web Application folder has the right ...
Read more >
failed to launch debug adapter cannot connect to runtime ...
failed to launch debug adapter. cannot connect to runtime process timeout after 10000 econnrefused. simply trying to debug ASP.Net Web Application.
Read more >
389823 – Launching debug session sometimes fails with error ...
6) Built project and tried to start a debug session. I get a message box showing this: 'Launching hello Debug' has encountered a...
Read more >
The Visual Studio 2022 Error "Failed to launch debug adapter ...
I had the same issue with Visual Studio 2022. I could solve the issue by disabling the script debugging in the drop-down of...
Read more >
Problem launching debug configuration - TI E2E
The exception happens when CCS attempts to build the project before launching a debug-session. To isolate the problem, try getting your project ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found