Aws-lambda-dotnet: Mock Test tool works fine until I renamed the project

Created on 6 Mar 2019  路  13Comments  路  Source: aws/aws-lambda-dotnet

The test tool was working perfectly until I had to rename a project. I altered the
aws-lambda-tools-defaults.json file to have the correct spelling but the tool is still broken. When I launch it no function is found and it launches with the wrong profile (different than what is listed in the aws-lambda-tools-defaults.json file)

guidance

Most helpful comment

I found that my function-handler was pointing to the old project name it looks like the format is
"{dll_name}::{namespace}.Function::FunctionHandler" in the aws-lambda-tools-defaults.json.

it worked to me.

All 13 comments

Are you using the tool in Visual Studio or another IDE like VSCode? If you go into a console window to the directory of the project and execute the following command

dotnet lambda-test-tool-2.1

Does it work, albeit without an IDE debugging it?

I was using Visual Studio 2017, I tried it through the command line using the dotnet lambda-test-tool-2.1 but it was the same result, no function is populated in the dropdown. I have double checked my aws-lambda-tools-defaults.json file and everything looks correct

I am facing the same issue. I created a .Net core lambda project and then renamed pretty much everything in the project (csproj, namespace, classes). Then I modified the aws-lambda-tools-defaults.json file to match with my fucntion. The mock tool runs and just won't populate the function name. It also loads up the wrong profile. I tried going in the root directory and running the command, same result. If I revert back my json file, it populates the function name. But it would obviously error out since that function doesn't exsist anymore

Yes, I am also facing same issue. I created a .Net core lambda project and then change the namespace everything else kept same. Then I modified the aws-lambda-tools-defaults.json file to match with my fucntion (with new namespace). The mock tool runs and just won't populate the function name.

I fixed this issue by deleting the bin and obj folders from my projects directory. Rebuilt both the release and debug versions of the project then it ran fine.

I'm closing this based on the guidance from Jhsosa.

I have this same issue - but cleaning the bin & obj folders has not fixed the issue for me.
I have tried renaming things back to the default (Function.cs & FunctionHandler method name) but still it's not working.

I have this same issue - but cleaning the bin & obj folders has not fixed the issue for me.
I have tried renaming things back to the default (Function.cs & FunctionHandler method name) but still it's not working.

same for me

I'm closing this based on the guidance from Jhsosa.

Given that the issue still seems to be present, can we re-open this issue?

I found that my function-handler was pointing to the old project name it looks like the format is
"{dll_name}::{namespace}.Function::FunctionHandler" in the aws-lambda-tools-defaults.json.

it worked to me.

For me the problem was fixed by making sure that the serverless.template and the lambda-tools.json was set to 'Always Copy'.

For me, I had copied one project to another (different assembly, namespaces) and tried to tweak the aws-lambda-tools-defaults.json, but the function drop-down was blank until I went to launchSettings.json and used a different port number.

For me, I did not need to set the properties on aws-lambda-tools-defaults.json "copy to output directory" to "Always Copy". It is able to find the config file in the local project file.

My issue was that in my aws-lambda-tools-defaults.json file I was missing the "framework" property. Apparently, that is required and not just the function-runtime.

Here is my .json for a "Basic" Lambda (not serverless)

{
  "Information": [
    "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
    "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",

    "dotnet lambda help",

    "All the command line options for the Lambda command can be specified in this file."
  ],

  "profile": "default",
  "region": "us-east-2",
  "configuration": "Debug",
  "framework": "netcoreapp3.1",
  "function-runtime": "dotnetcore3.1",
  "function-memory-size": 512,
  "function-timeout": 30,
  "function-handler": "{assembly name w/o extension}::{namespace}.{class}::{function}"
}
Was this page helpful?
0 / 5 - 0 ratings