sam local start-api takes a flags --debugger-path , --debug-port . But i am yet to see example of usage of these for debugging purposes.
I have a typescript project with a lot of lambdas; my debugging process has been :
sam local start-api followed by calling specific service from postman and reading the logs from console.logs i have put in multiple places. if i want to see some object i have to JSON.stringify it and log it.....
This is painful process and i have yet able to setup the project to work with vscode debugger using typescript. all my break points get ignored (they are not grey)
i have this configuration in vscode launch.json, but it does not work. I was running it after i do sam local start-api . It starts and terminates in about 30seconds.
{
"configurations": [
{
"name": "Attach to SAM Local API",
"type": "node",
"request": "attach",
"address": "localhost",
"port": 5858,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/var/task",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"sourceMaps": true
},
When a service is called from postman; sam mounts the specific lambda in docker container and runs the lambda. How can i make vscode break when the current lambda is mounted in docker container? I assume debuger must be running and waiting for me to make the call from postman..and when i do sam mounts the corresponding lambda in a container...and then the running debugger connects to the debug session from the container???
Is this were --debugger-path , --debug-port become useful?