Comments (5)
Thanks for the report! The Toolkit error message is indeed confusing. #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?
- Download and extract buildArtifacts.zip
- In VSCode, run
Extensions: Install from VSIX
to install the*.vsix
file. (You can run commands withctrl-shift-p
orcmd-shift-p
) - Reload VSCode and verify that the Toolkit has the new version (not the older version).
from aws-toolkit-vscode.
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
from aws-toolkit-vscode.
Thank you for testing! I can confirm the same results. I tried your demo repo with these steps:
- setup
git clone https://github.com/azgorov/demos npm install cdk synth rm pnpm-lock.yaml
- update
aws:asset:path:
intemplate.yml
- confirmed these settings in
tsconfig.json
"inlineSourceMap": true, "inlineSources": true, "noEmit": false,
- set breakpoint in
lib/lambda/xx.ts
- AWS Toolkit invoked the function, with the correct sam cli
--debug
command:sam local invoke --debug xxDE507B92 --template /tmp/aws-toolkit-vscode/vsctk26c62125/output/template.yaml -d 5858
- output correctly indicates that debugger was attached:
Debugger attached.
- ... but it invokes the function without stopping at the breakpoint.
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\"}"}
from aws-toolkit-vscode.
Workaround
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
.
from aws-toolkit-vscode.
Status
- Typescript lambda debugging works in some cases, but is not fully supported by AWS Toolkit, yet. #3210
- #3099 improved support for debugging typescript lambdas, but there is still work to do.
- After #4282, Toolkit can invoke
AWS::Lambda::Function
lambdas
Resolution
Because #4282 fixes the AWS::Lambda::Function
error message, and #3210 tracks the more general topic of SAM typescript debugging, I am closing this issue.
from aws-toolkit-vscode.
Related Issues (20)
- The automatic agent of Amazon Q interrupts with my code editing HOT 4
- Amazon Q Chat Hang HOT 5
- Amanzonginyu
- Amazon Q marks single line blocks as missing delimiter (CWE-483)
- Publish `AmazonWebServices.amazon-q-vscode` to Open VSX HOT 6
- When asking questions to Q about CDK python many responses include functions or attributes that do not exist. How can this behaviour be avoided?
- URL Validation Failure for Workforce SSO connection
- ignore/disable Amazon Q inline suggestions HOT 1
- Unable to see the login screen for aws builder login HOT 2
- Improve copy + paste formatting for Q responses
- 你好 HOT 1
- [Amazon Q chat bug] An error occurred while loading view: aws.AmazonQChatView HOT 4
- VS Code not showing suggestion widget HOT 1
- (Colima) sam local invoke Command Succeeds, but VSCode Debugging Fails HOT 4
- Option to disable specific CWE checks HOT 2
- AWS
- Debugging Lambdas with a Layer (Or alternative) HOT 2
- Can the extension NOT display a message in red if it is not logged in
- Disable recommendations per line/file for Amazon Q HOT 2
- Extension causes high cpu load HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-toolkit-vscode.