Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can´t replicate "Run locally" for lambda visual studio code

I have an existing project with lambdas in netcore2.1.

Recently I discovered the aws toolkit for VS Code and there is a great function that I want on my project

Run Locally | Debug Locally

When I created a test sam application and I navigate to the function Lambda Handler I notice VS Code adds the next options:

  • Run Locally
  • Debug locally
  • Configure

If I click configure it shows a file in .aws/templates.json (but I also noticed that even if the file is missing it works on the test project)

I tried to replicate that file, and also the yaml file to describe my function, and the aws-lambda-tools-defaults.json

But nothing make appears the options, also I tried using the same functionhandler

no functions available

But nothing seems to make appear that run locally|Debug locally options

Does anyone knows how to make it work ?

like image 630
Sergio López Avatar asked Dec 06 '25 08:12

Sergio López


1 Answers

There was a problem with the template.yaml and the handler.

  Handler: LoginSatFunction::LoginSatFunction.Function::FunctionHandler

It is essential to check the naming convention here

After having the correct naming in the handler, it worked like a charm.

Also, there is an issue in Visual Studio Code regarding Code Lens when using Environment Variables without apostrophes '', I reported it here.

So you should also check your Environment Variables in yaml to have apostrophes as a workaround meanwhile the bug is solved.

like image 63
Sergio López Avatar answered Dec 07 '25 23:12

Sergio López



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!