Documented handler max length of 128 characters isn't supported

Open
#1,642 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
aws, csharp
Domain
backend, cloud

Research direction

Start with UserCodeLoader.cs, especially the parsing path around the reported line 242, and reproduce the dotnet6 case with the exact 128-character handler shown in the issue. Trace where the handler name loses its final character, then verify that the unchanged value invokes the handler successfully.

Written by the indexing model from the issue text.

Description

bug module/lambda-client-lib p2 queued service-api
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 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:

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

Dominant language
C#
Stars
1.7k
Forks
503
Avg merge
1d 18h
Merged PRs (30d)
21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-lambda-dotnet

All issues in aws/aws-lambda-dotnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.