I have tried to debug serverless application developed using serverless framework in VS code. I have followed this article.
But when I trying to debug the code I\'m
Do what the other guides state and setup your project with a launch.json file.
The problem I had was that the supposed file "program": "${workspaceRoot}/node_modules/.bin/sls" threw an error.
I changed it to "${workspaceRoot}/node_modules/serverless/bin/serverless" and it worked. Here's the full file:
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Serverless debug",
"program": "${workspaceRoot}/node_modules/serverless/bin/serverless",
"args": [
"invoke",
"local",
"-f",
"hello",
"--data",
"{}"
]
}
]
}
Be aware that the argument hello is the name of the function I want to debug. I think the intended use case must be that you change that file name for whatever function you want to invoke. Maybe someone could create a VSCode plugin to do this?