Support for Lambda function URLs
Describe the feature
The AWS Lambda team recently added a new feature - function Urls. It would be great to support it in Amazon.Lambda.Annotations library.
Use Case
FunctionUrls implies that one function can handle several different HTTP requests. This allow using Lambda for HTTP handling without API Gateway which greatly simplifies the cloud solution.
Proposed Solution
No response
Other Information
No response
Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
AWS .NET SDK and/or Package version used
Amazon.Lambda.APIGatewayEvents 2.4.1, Amazon.Lambda.Core 2.1.0
Targeted .NET Platform
.NET 6
Operating System and version
All Operating System
Hi @ggaller.
First off you can use function urls today by using the APIGatewayHttpApiV2ProxyRequest and APIGatewayHttpApiV2ProxyResponse types. Lambda function urls use the exact same event format as API Gateway HTTP API v2 format.
Long term I'm in debate how best to support the event type. We should probably create a copy of the API Gateway HTTP API types and name them something more appropriate. Since it doesn't use API Gateway it doesn't really make sense to put the event type in the Amazon.Lambda.APIGatewayEvents package. But we have never had a event type that was defined by the Lambda service so I might have to create a new Amazon.Lambda.LambdaEvents package.
Hello @normj.
Thanks for the detailed explanation. This is my bad, because when I created this issue, I thought that this is the LambdaAnnotations library repository. I forgot that it is a common repository for all Lambda .Net projects.
The feature request was addressed to the LambdaAnnotations library. I tried APIGatewayHttpApiV2ProxyRequest/APIGatewayHttpApiV2ProxyResponse with function urls and it works great. Then I tried adapting LambdaAnnotations and realised that they do not support this functionality.
It would be very convenient to mapping the incoming APIGatewayHttpApiV2ProxyRequest (using function Urls) to methods of different controllers.
Hi @ggaller,
Good morning.
Thanks for submitting feature request. Could you please confirm if you are mentioning to add Lambda function URL support in Lambda package or the AWS Extensions for .NET CLI lambda tooling? Refer https://github.com/aws/aws-lambda-dotnet/discussions/1168 where user was able to generate Lambda function URL by utilizing simple Lambda function.
Thanks, Ashish
@ggaller Agreed we should figure out how to get Lambda Urls as part of Amazon.Lambda.Annotations.
In my project where as a developer we can't debug multiple lambda functions running locally. They call each other via http protocol. We are using .NET Core 3.1, .NET 6 and Visual Studio 2022 for Lambda functions and using Mock tool for debugging the functions. I made some changes to the aws-lambda-dotnet tool to support this functionality without using any other third party tool. So when i run the project using Mock Lambda Test Tool, apart from its Razor stuff, it also creates the http endpoints . When the http endpoint is called i could put a breakpoint in the source code of the Lambda Function in Visual Studio 2022 and it would hit the breakpoint with all the required input parameters and sends the proper response also. Happy to submit a PR for the change
@nishant-newton I would be interested in seeing a PR of the work you have done.
@normj sure i can do something to show you my work not sure of the PR though. I was expecting some response from aws team about the approval of your feature request. There is a separate feature request (https://github.com/aws/aws-lambda-dotnet/issues/1279) i have also submitted. With the approval of the feature request it is easy to submit the PR. But may be i will put my code in some branch and share it with you so that if you are having the same issue, hopefully my changes would help you.