serverless-bundle icon indicating copy to clipboard operation
serverless-bundle copied to clipboard

Local debugging in VS Code no longer working with v5.0.2

Open jollifft opened this issue 4 years ago • 3 comments

Just started a new project that is using serverless-bundle, and I'm unable to get local debugging to work in VS Code. The code runs, but all breakpoints are skipped. I am using the same launch.json configuration that I have used in previous projects that utilized serverless-bundle version 4.3.0.

Removing version 5.0.2 from my project and reinstalling version 4.3.0 seems to resolve the issue and breakpoints work as expected.

Here's my launch.json file:

{
    // 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": [
        {
            "type": "node",
            "request": "launch",
            "name": "updatePolicy",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/node_modules/.bin/serverless",
            "args": [
                "invoke",
                "local",
                "-f",
                "updatePolicy",
                "--path",
                "./mockEvents/updatePolicyEvent.json"
            ],
            "outputCapture": "std",
            "sourceMaps": true,
            "outFiles": [
                "${workspaceFolder}/.webpack/**/*.js"
            ],
            "runtimeArgs": [
                "--lazy"
            ]
        }
    ]
}

Any insight would be greatly appreciated!

jollifft avatar Nov 02 '21 22:11 jollifft

Do we have any light on this? Is anyone here able to to use VSCode debug?

ryok90 avatar Nov 22 '22 20:11 ryok90

+1

saravmajestic avatar Nov 29 '22 10:11 saravmajestic

Do we have any light on this? Is anyone here able to to use VSCode debug?

Nope, The only way to get attached to the debugger is to enable the debugger option (in the lower left) "Uncaught exceptions" and VSCode will open something like a duplicate file where you will be able to place the working breakpoints. This is my config:

{
     "type": "node",
     "request": "launch",
     "name": "Launch Program",
     "program": "${workspaceRoot}/node_modules/serverless/bin/serverless",
     "args": [
       "invoke",
       "local",
       "-f",
       "test",
       "--path",
       "data.json"
     ],
     "sourceMaps": true,
     "outputCapture": "std",
     "runtimeExecutable": "node",
     "runtimeArgs": ["--lazy", "--inspect"],
     "outFiles": [
       "${workspaceRoot}/.webpack/**/*.js",
     ],
     "env": {
       "SLS_DEBUG": "*"
     }
   }

I have lost more than a day on this but there is no way to let it work.

More info: MacOS 12.3 NVM Node v16.18.1

gianpaolopascasidc avatar Dec 01 '22 11:12 gianpaolopascasidc