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

Debugger not working, Unable to retrieve source content from standard library #233

Closed
David-Else opened this issue Sep 24, 2020 · 15 comments
Labels
bug Something isn't working

Comments

@David-Else
Copy link

I press f5 in mod.ts to debug, choose deno, but then a file called colors.ts appears with:

Could not load source '/home/xx/workspace-directory/std@0.70.0/fmt/colors.ts': Unable to retrieve source content.

The repo is https://github.com/David-Else/eslint-config-octopus and video:
out

Versions

vscode: 1.49.1
deno: 1.4.1
extension: 2.3.1

@Sharpiro
Copy link

I'm getting this error with the sample web server from the manual

https://deno.land/manual/examples/http_server

Could not load source '/home/user/src/app/server/std@0.71.0/encoding/utf8.ts': Unable to retrieve source content.

@algj
Copy link

algj commented Nov 20, 2020

For me debugger is working but debugger stops at std/fmt/colors.ts:44 like there's a breakpoint there, but I have no breakpoints enabled and disabled uncaught exceptions breakpoints.

Sometimes debugger shows filenames like colors.ts>, mod.ts> with > at the end. Sometimes it does not.

@David-Else
Copy link
Author

@algiuxass Have you tried with the launch.json from https://deno.land/manual@v1.5.3/getting_started/debugging_your_code#vscode?

@mvolkmann
Copy link

@David-Else I looked over the notes at the site you suggested, but it didn't help. I can run the debugger. If I step into an import module, I get a popup that says "This is a missing file path referenced by a sourcemap. Would you like to debug the compiled version instead?". If I click "Yes" then I can step through the compiled code. So there are two issues:

  1. Why does it ask me that question for every imported source file I step into?
  2. Why doesn't it recognize the "//# sourceMappingURL" comment at the bottom of those files and let me step through the TypeScript code of the imported source file?

Here is my .vscode/launch.json file inside my Deno project:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Deno",
      "type": "pwa-node",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": [
        "run",
        "-A",
        "--inspect-brk",
        "${file}"
      ],
      "attachSimplePort": 9229,
      "outputCapture": "std"
    }
  ]
}

@mct-dev
Copy link

mct-dev commented Dec 2, 2020

I'm in the same boat as @mvolkmann. Same exact questions and problems. ☹️

@hoangtranson
Copy link

I just update to Deno 1.7 and got same issue.

Could not load source '.../x/oak@v6.4.1/cookies.ts': Unable to retrieve source content.

@Alqio
Copy link

Alqio commented Feb 7, 2021

I get the same problem as @Sharpiro with Deno 1.7.2 with VS code deno plugin v2.3.3. I'm using WSL 2. Any fixes?

@edualb
Copy link

edualb commented Feb 13, 2021

I got a similar problem for debug my tests here... but I can continue running the debugger after click continue(f5). It is not interrupting my work but disturbs me.

Deno v.1.7.2
OS: Ubuntu 18.04.5

My lauch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Test Deno",
      "request": "launch",
      "type": "pwa-node",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": [
        "test",
        "--inspect-brk",
        "--config",
        "tsconfig.json"
      ],
      "outputCapture": "std",
      "attachSimplePort": 9229
    }
  ]
}

output

@Soremwar
Copy link

Soremwar commented Feb 13, 2021

To all people in this thread, you seem to be having two different issues.

One of them is that the inspector is pausing everytime you start it, forcing you to resume it as is the case of @edualb . That can be easily fixed by not using --inspect-brk but --inspect on your launch configuration. --inspect-brk is meant to pause on the first line of code executed, causing that "annoyance", even though it's working as intended.

The second one is the fact that the inspector can't debug remote code correctly, causing the Could not load source '/home/user/src/app/server/std@0.71.0/encoding/utf8.ts': Unable to retrieve source content. error. This should only be a problem if you really want to debug third party code.

@Alqio
Copy link

Alqio commented Feb 16, 2021

@Soremwar At least for me the Could not load source '/home/user/src/app/server/std@0.71.0/encoding/utf8.ts': Unable to retrieve source content. problem comes whenever I try to run the code, not trying to debug third party code. I'm fairly certain it's related to WSL2 somehow.

@Soremwar
Copy link

@Alqio What is the command you are using to run the code? Are you using a launch.json configuration that you can show?

@Alqio
Copy link

Alqio commented Feb 17, 2021

{
            "name": "Launch Deno",
            "request": "launch",
            "type": "pwa-node",
            "program": "App.ts",
            "cwd": "${workspaceFolder}",
            "runtimeExecutable": "deno",
            "runtimeArgs": [
                "run",
                "--allow-all",
                "--allow-net",
                "--inspect-brk"
            ],
            "attachSimplePort": 9229
        }

You were actually correct I believe, because removing --inspect-brk removes the problem. However, does that mean it's impossible to debug a deno project?

@Soremwar
Copy link

@Alqio No, as I explained above it's quite easy to debug your project. However there is currently a limitation when debugging third party code (url imports) that causes the error that you commented earlier, but putting breakpoints in your own code (even with url imports) works just fine.

@kitsonk kitsonk added bug Something isn't working and removed needs investigation labels Aug 30, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Aug 30, 2021

This is related to denoland/deno#11874. I believe fixing the source maps will fix this issue.

@bartlomieju
Copy link
Member

I believe this is now fixed, since debugger in Deno can handle source maps without a problem. Please let me know if the issue persists with latest Deno version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests