aws / aws/aws-lambda-dotnet

Documented handler max length of 128 characters isn't supported

Open
#1,642 5 comments 1 reaction 0 assignees View on GitHub
bug module/lambda-client-lib p2 queued service-api
Dominant language
C#
Stars
1.7k
Forks
503
Avg merge
1d 5h
Merged PRs (30d)
18

Description

### Describe the bug

AWS documentation says the `Handler` property has a [max length 128 characters](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Handler), but values exactly 128 characters long appear to be truncated to 127 characters in the `dotnet6` 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:

```log
Amazon.Lambda.RuntimeSupport.ExceptionHandling.LambdaValidationException: Unable to find method 'HandleAsyn' in type 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.LambdaFunction' from assembly 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX': Found no methods matching method name 'HandleAsyn'.
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 155
```

### Reproduction Steps

1. Create a Lambda with a handler specification that is exactly 128 characters long.
2. Try to invoke the function.

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.