Aaron
Aaron

Reputation: 3068

Debugging Aleph apps in VSCode

How are you debugging Aleph apps inside Visual Studio code?

NOTE: I'm referring to debugging my application that's running inside the Aleph framework, not actually debugging Aleph itself.

Similary (but not the same of course) as Nextjs:

Start the server:

$ aleph dev -reload

INFO Server ready on http://localhost:8084/

Then try to attach to the process in the launch.json:

  "configurations": [
    {
      "type": "pwa-node",
      "name": "Aleph: Run",
      "request": "attach",
      "port": 8084
    },

But no chance. Has anyone out there got this configuration working in Aleph yet?


Throws after I add your launch.json @Dizzy

With JS debugger (nightly) enabled:

Error processing launch: Error: Could not connect to debug target at http://127.0.0.1:8080: Promise was canceled at e (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:1:115007) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) at async t (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:59:61879) at async P.launch (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:1:135988) at async t.Binder.captureLaunch (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:59:152076) at async t.Binder._launch (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:59:151627) at async Promise.all (index 3) at async t.Binder._boot (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:59:150887) at async t.default._onMessage (/Users/aadams/.vscode/extensions/ms-vscode.js-debug-nightly-2021.3.3017/src/extension.js:1:88464)

With JS debugger enabled:

Error processing launch: Error: Could not connect to debug target at http://127.0.0.1:8080: Promise was canceled at e (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:114976) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) at async t (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:61879) at async P.launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:135957) at async t.Binder.captureLaunch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:152076) at async t.Binder._launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:151627) at async Promise.all (index 3) at async t.Binder._boot (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:150887) at async t.default._onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:88464)

Upvotes: 1

Views: 257

Answers (1)

Dizzy
Dizzy

Reputation: 902

This is not fully working because breakpoints are not being hit. But you can put debugger in your code and it will stop there.

.vscode/launch.json

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Deno: Run",
      "request": "launch",
      "type": "pwa-node",
      "cwd": "${workspaceFolder}",
      "runtimeExecutable": "deno",
      "runtimeArgs": [
        "run",
        "--inspect",
        "--unstable",
        "-A",
        "https://deno.land/x/[email protected]/cli.ts"
      ],
      "args": ["dev"],
      "attachSimplePort": 9229,
      "outputCapture": "std"
    }
  ]
}

Upvotes: 1

Related Questions