I tried to follow the same article and experienced the same error. Adding outFiles did not help, although it changed my error message to:
Cannot launch program 'd:\<path>\node_modules\.bin\sls' because corresponding JavaScript cannot be found.
I cannot explain why VSCode has a problem with the executable in node_modules/.bin , but if I instead node_modules/serverless/bin on node_modules/serverless/bin , everything will work as expected:
"program": "${workspaceFolder}\\node_modules\\serverless\\bin\\serverless",
Here is my full working configuration, where my test JSON event exists in sample-event.json in the root of the project:
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Debug Lambda", "program": "${workspaceFolder}/node_modules/serverless/bin/serverless", "args": [ "invoke", "local", "-f", "<function-name>", "--data", "{}" // You can use this argument to pass data to the function to help with the debug ] } ] }
Using Serverless ^ 1.26.1, Node 8.9.4 LTS, VSCode 1.20.1
source share