Closed azgorov closed 6 months ago
Thanks for the report! The Toolkit error message is indeed confusing. https://github.com/aws/aws-toolkit-vscode/pull/4282 changes the validation to allow AWS::Lambda::Function
resources.
If sam
cli supports AWS::Lambda::Function
, then you should get a better result with that change.
Can you try this vsix and confirm the result?
Extensions: Install from VSIX
to install the *.vsix
file. (You can run commands with ctrl-shift-p
or cmd-shift-p
) Thank you Justin.
New build fixed error message. Now SAM starts but it does not stop at breakpoint. I am not sure now if it is a problem is in my simple code or something in sam settings.
I have created demo project with 1 typescript lambda that shows debug issue: https://github.com/azgorov/demos
Best Kalin
Thank you for testing! I can confirm the same results. I tried your demo repo with these steps:
git clone https://github.com/azgorov/demos
npm install
cdk synth
rm pnpm-lock.yaml
aws:asset:path:
in template.yml
tsconfig.json
"inlineSourceMap": true,
"inlineSources": true,
"noEmit": false,
lib/lambda/xx.ts
--debug
command:
sam local invoke --debug xxDE507B92 --template /tmp/aws-toolkit-vscode/vsctk26c62125/output/template.yaml -d 5858
Debugger attached.
2024-01-15T17:00:52.331Z 2b158033-9bcc-4784-bfcc-5173d6514127 INFO {} 1
END RequestId: 2b158033-9bcc-4784-bfcc-5173d6514127
REPORT RequestId: 2b158033-9bcc-4784-bfcc-5173d6514127 Init Duration: 0.21 ms Duration: 644.31 ms Billed Duration: 645 ms Memory Size: 128 MB Max Memory Used: 128 MB
{"statusCode": 200, "body": "{\"message\":\"Hello World\"}"}
Using a target: code
launch config in your demo project, works:
{
"name": "node18",
"type": "aws-sam",
"request": "direct-invoke",
"invokeTarget": {
"target": "code",
"lambdaHandler": "lib/lambda/xx.handler",
"projectRoot": "${workspaceFolder}/"
},
"lambda": {
"runtime": "nodejs18.x"
},
"sam": {
"containerBuild": false,
"skipNewImageCheck": false
}
},
With that launch config, I was able to hit a breakpoint in xx.ts
.
AWS::Lambda::Function
lambdasBecause #4282 fixes the AWS::Lambda::Function
error message, and #3210 tracks the more general topic of SAM typescript debugging, I am closing this issue.
System details (run the
AWS: About Toolkit
command)Question
Is debug config works with AWS CDK synth generated template?
Steps to reproduce:
if I try normal node attachment to sam debugging works with specific localRoot
if I try "AWS: Add SAM Debug Configuration" with synth template I got something like :
Which looks fine but trying to run it I've got an exception:
Template.yml contains following resource: