Skip to content

wskdebug does not work with new vs code debugger #74

@alexkli

Description

@alexkli

Update: Solution 🎉

If you are coming here from the warning given by wskdebug WARNING: wskdebug itself is debugged and likely NOT the action, then you have to update your VS Code launch config.

Starting with VS Code 1.48+ these settings are required to work with wskdebug:

            "type": "pwa-node",
            "request": "launch",
            "attachSimplePort": 0,
            "killBehavior": "polite",

Here is a complete example - adjust the args and name as needed:

    "configurations": [
        {
            "name": "wskdebug MYACTION", // <-- adjust name for debug drop-down
            "type": "pwa-node",
            "request": "launch",
            "attachSimplePort": 0,
            "killBehavior": "polite",
            "runtimeExecutable": "wskdebug",
            "args": [
                "MYACTION",  // <-- replace with name of the action
                "ACTION.js", // <-- replace with local path to action source file
                "--cleanup", // remove helper actions on shutdown
                "-l",        // enable live-reload
                "-v"         // log parameters and results
            ],
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "/code",
            "outputCapture": "std"
        }
    ]

This is also documented here: https://github.com/apache/openwhisk-wskdebug#nodejs-visual-studio-code


.
.
.

Original issue:

Problem

The new VS code debugger recently released (?) no longer sets --inspect-brk=XXXX for the debug port which wskdebug can intercept, but instead sets a NODE_OPTIONS with a custom --require that loads a (large) VS code javascript file into the process which apparently sets up debugging internally. This leads to the wskdebug node process itself being debugged, not the actual action on the container.

Links

▶️ Solutions ◀️

Collecting all solutions here, will be kept updated.

Quick Workaround

Simple workaround for now: Disable the new debugger in VS Code by setting this in the user settings json:

"debug.javascript.usePreview": false

This will work as long as VS Code supports this feature.

Future fix

The new VS Code debugger will get some changes that make it work with wskdebug. To get a preview, one has to install the VS code debugger nightly. Do this at your own risk.

  1. install nightly of debugger plugin (after July 16)
  2. in launch config have this:
    {
       "type": "pwa-node", // important
       "request": "launch",
       "name": "wskdebug",
       "attachSimplePort": 0, // instead of "port", makes it auto-select a free debug port
  3. use latest wskdebug 1.3.0 RC. install the pre-release from github directly:
    npm install -g https://github.com/apache/openwhisk-wskdebug
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions