-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Unable to debug typescript sam app via VScode breakpoints #6658
Comments
TLDR version:
Since the lambda is running in a container at time of execution (api call); what is the proper vscode configuration for the debugger to be notified that 'we mounted a lambda in a container for execution...and that it needs to break in typescript code. I know the js and map file are deployed correctly in `/var/task folder |
Hey @DawitAskabe, thanks for raising the issue. As you've mentioned, the Lambda Function is running within a container. So I don't think the "node" type would work. You can install AWS Toolkit in VS Code. It provides the "aws-sam" type in launch config so that you can use it to debug your SAM application. For details, please see https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps.html. Please let us know if you have further question. |
I am running into the same issue not being able to debug using the AWS Toolkit. Is there a supported way to do this? Can someone just test the latest plugin with the latest cli and make sure the hello-world typescript app is debuggable without making any changes (and at least document any changes that need to be made?) |
It seems to be an open bug in AWS Toolkit - aws/aws-toolkit-vscode#3210 Closing |
|
Description:
We are trying to debug lambdas via VScode by calling the services locally from postman.
VScode does not remain open or attached for us to be able to break or debug.
Steps to reproduce:
Currently our debug workflow is to run :
"start": "npm run build & sam local start-api",
This mounts all the lambdas as follows
Then we use postman to make API call to one of these lambdas. (the lambdas execute and finish fine without stopping at breakpoints)
I have spent countless hours to get vscode to stop at breakpoints. This is my current configuration in launch.json
The above is what i have currently but i attempted countless variations.
I attempted to run sam using
sam local start-api -d 5858 -p 3000 --debugger-path "$(pwd)/.vscode"
and setting 5858 as port in launch.json without luck.our build step generate maps for each lambda and put it in dist folder in this structure.
dist
├── todo-put
│ ├── application.yml
│ ├── index.js
│ └── index.js.map
└── todo-tasks-get
├── application.yml
├── index.js
└── index.js.map
Observed result:
Following the above setups; once
sam local start-api
is done and api paths are mounted; if i try to run the debugger it makes some get calls and fails...(these are some random api calls i have no idea about).Expected result:
vscode should wait for api calls to happen and stop at breakpoint in the invoked lambda.
When the api call is made from postman, sam invokes the index.handler and mounts it in the docker container to run (from what i can gather from the output bellow). Vscode debugger should stop at breakpoint once the lambda is running in the container.
This is the sam output when calling a service from postman - finishes correctly
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 1.100.0Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: