-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documented handler max length of 128 characters isn't supported #1642
Comments
@SeijiSuenaga Good morning. Thanks for opening the issue. Kindly refer Lambda function handler in C#; if you scroll down a little, there is an example for format of function handler If you deploy this function via Visual Studio (using latest AWS Toolkit), it will throw validation error during deployment. Could you check the function handler name (in above format) in your Lambda function settings? Thanks, |
@ashishdhingra Ah I'm sorry, I got that example wrong 😓 but my actual Lambda function settings have the correct format you specified. Here's the actual format I'm using, with my company's namespace hidden:
And the resulting error:
I'll edit the OP to correct the example. |
Appears to be reproducible using below code: using Amazon.Lambda.Core;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;
public class LambdaFunction
{
public async Task<string> HandleAsync(string input, ILambdaContext context)
{
return await Task.Run<string>(() => { return input.ToUpper(); });
}
} aws-lambda-tools-defaults.json {
"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" : "Release",
"function-architecture" : "x86_64",
"function-runtime" : "dotnet6",
"function-memory-size" : 256,
"function-timeout" : 30,
"function-handler" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX::XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.LambdaFunction::HandleAsync",
"framework" : "net6.0",
"function-name" : "TestFunction",
"package-type" : "Zip",
"function-role" : "arn:aws:iam::139480602983:role/lambda_exec_TestFunction",
"function-subnets" : "",
"function-security-groups" : "",
"tracing-mode" : "PassThrough",
"environment-variables" : "",
"image-tag" : ""
} The handler name is {
"errorType": "LambdaValidationException",
"errorMessage": "Unable to find method 'HandleAsyn' in type 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.LambdaFunction' from assembly 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX': Found no methods matching method name 'HandleAsyn'.",
"stackTrace": [
"at Amazon.Lambda.RuntimeSupport.Bootstrap.UserCodeLoader.FindCustomerMethod(Type type) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/UserCodeLoader.cs:line 242",
"at Amazon.Lambda.RuntimeSupport.Bootstrap.UserCodeLoader.Init(Action`1 customerLoggingAction) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/UserCodeLoader.cs:line 116",
"at Amazon.Lambda.RuntimeSupport.Bootstrap.UserCodeInitializer.InitializeAsync() in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/UserCodeInitializer.cs:line 46",
"at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.InitializeAsync() in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs:line 159"
]
} Might be some issue in Needs review with the team. Thanks, |
Discussed with the team. Somehow the runtime is not passing correct handler string (refer here). We need to contact service team for the root cause. |
P109288213 |
… the package type is set to zip Addresses #1642
Describe the bug
AWS documentation says the
Handler
property has a max length 128 characters, but values exactly 128 characters long appear to be truncated to 127 characters in thedotnet6
Lambda runtime, and therefore fail.Expected Behavior
A handler value exactly 128 characters long shouldn't be truncated and should invoke the handler method successfully.
Current Behavior
A handler value exactly 128 characters long, such as:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX::XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.LambdaFunction::HandleAsync
produces a failure:
Reproduction Steps
Possible Solution
No response
Additional Information/Context
AWS Console shows the full value in the "Runtime settings" of the Lambda function, so it seems to be getting truncated somewhere in the Lambda runtime.
AWS .NET SDK and/or Package version used
N/A — this bug is independent from .NET SDK.
Targeted .NET Platform
.NET 6
Operating System and version
Amazon Linux 2
The text was updated successfully, but these errors were encountered: