Use SourceGeneratorLambdaJsonSerializer for AspNetCoreServer functions
Describe the feature
Currently reflection-based DefaultLambdaJsonSerializer is used for AspNetCore functions. But since we know for sure which types (HttpApi/RestApi/LoadBalancer) are going to be used there, probably it makes sense to use source-generated SourceGeneratorLambdaJsonSerializer.
Use Case
Improved performance (especially cold-start) and better AOT compatibility.
Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
Needs review with the team.
This can be done using the AddAWSLambdaHosting override that takes in a SourceGeneratorLambdaJsonSerializer<T>. There are no plans to put a SourceGeneratorLambdaJsonSerializer<T> in the package automatically because we would have to do that for all supported Lambda event types and that would bloat the package. As I recall when I look into this in the past I would even have to make each request/response event pairing be separate SourceGeneratorLambdaJsonSerializer<T> because the types cause interference if I add them all to the same type of SourceGeneratorLambdaJsonSerializer<T>
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.