Giter Club home page Giter Club logo

Comments (5)

justinmk3 avatar justinmk3 commented on July 19, 2024

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?

  1. Download and extract buildArtifacts.zip
  2. In VSCode, run Extensions: Install from VSIX to install the *.vsix file. (You can run commands with ctrl-shift-p or cmd-shift-p)
  3. Reload VSCode and verify that the Toolkit has the new version (not the older version).

from aws-toolkit-vscode.

azgorov avatar azgorov commented on July 19, 2024

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.

justinmk3 avatar justinmk3 commented on July 19, 2024

Thank you for testing! I can confirm the same results. I tried your demo repo with these steps:

  1. setup
    git clone https://github.com/azgorov/demos
    npm install
    cdk synth
    rm pnpm-lock.yaml
    
  2. update aws:asset:path: in template.yml
  3. confirmed these settings in tsconfig.json
    "inlineSourceMap": true,
    "inlineSources": true,
    "noEmit": false,
    
  4. set breakpoint in lib/lambda/xx.ts
  5. 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
    
  6. output correctly indicates that debugger was attached:
    Debugger attached.
    
  7. ... 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.

justinmk3 avatar justinmk3 commented on July 19, 2024

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.

justinmk3 avatar justinmk3 commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.