-
Notifications
You must be signed in to change notification settings - Fork 494
Closed
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessmodule/lambda-client-libp1This is a high priority issueThis is a high priority issueresponse-requestedWaiting on additional info and feedback. Will move to close soon in 7 days.Waiting on additional info and feedback. Will move to close soon in 7 days.
Description
Describe the bug
The generated code is awaiting the Task and attempting to return the Task, but because the original method is async, the original method is really a void, so it cannot be returned.
Expected Behavior
No compile errors.
Current Behavior
Receive Compile Error:
Severity Code Description Project File Line
Error CS1997 Since 'Functions_SqsMessageHandler_Generated.SqsMessageHandler(SQSEvent.SQSMessage, ILambdaContext)' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task<T>'? ServerlessWithSqs C:\Users\17034\source\repos\ServerlessWithSqs\ServerlessWithSqs\Amazon.Lambda.Annotations.SourceGenerator\Amazon.Lambda.Annotations.SourceGenerator.Generator\Functions_SqsMessageHandler_Generated.g.cs 35
Reproduction Steps
Steps to reproduce:
- Create a new serverless project
- Choose the Annotations blueprint
- In Function.cs add the below code:
[LambdaFunction]
public async Task SqsMessageHandler(SQSEvent.SQSMessage sqsMessage, ILambdaContext context)
{
await Task.Delay(1);
}
- Build the project
Possible Solution
remove the return?
return without the await?
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
<PackageReference Include="Amazon.Lambda.Annotations" Version="0.5.0-preview" />
Targeted .NET Platform
.NET 6
Operating System and version
Windows 11, AmazonLinux
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessmodule/lambda-client-libp1This is a high priority issueThis is a high priority issueresponse-requestedWaiting on additional info and feedback. Will move to close soon in 7 days.Waiting on additional info and feedback. Will move to close soon in 7 days.