Sergio López
Sergio López

Reputation: 973

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:

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 ?

Upvotes: 3

Views: 923

Answers (1)

Sergio López
Sergio López

Reputation: 973

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.

Upvotes: 1

Related Questions