Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an ETA for Configure method with ILambdaInvokeBuilder? #1714

Open
1 of 2 tasks
Nairda015 opened this issue Apr 3, 2024 · 6 comments
Open
1 of 2 tasks

Is there an ETA for Configure method with ILambdaInvokeBuilder? #1714

Nairda015 opened this issue Apr 3, 2024 · 6 comments
Labels
annotations feature-request A feature should be added or improved. m Effort estimation: medium p2 This is a standard priority issue queued

Comments

@Nairda015
Copy link

Describe the feature

Hey I want to create middleware or filter pipeline for lambda function
There is note about middleware in design doc but no information when it will happen

There are old PR without CR like this and idk if I should contribute

Use Case

global error handling, extracting standard headers like trace-id

Proposed Solution

I have workaround with more generated code and castle.core for intercepting calls
For class FunctionHandler I can generate IFunctionHandler and FunctionHandlerWrapper.
Next I can call FunctionHandler from FunctionHandlerWrapper.
Also need to register FunctionHandler as TryAddSingleton<IFunctionHandler, FunctionHandler> so it is interceptable.

Maybe before full middleware pipeline implementation can we add option to generate IFunctionHandler by the annotation framework and resolve it from DI by interface in generated code?

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.Annotations --version 1.2.0

Targeted .NET Platform

.NET 6

Operating System and version

AmazonLinux

@Nairda015 Nairda015 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 3, 2024
@ashishdhingra
Copy link
Contributor

@Nairda015 Good afternoon. Thanks for opening the issue. Please refer similar discussion started on #1688 (comment). Similar discussion #1683. Annotations doesn't leverage ASP.NET pipeline. I'm unsure if your use case is similar, could you please validate?

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 3, 2024
@Nairda015
Copy link
Author

I mean something like this
I don't need ASP pipeline like in #1688 I need a way to intercept handler calls so I can put common logic before

@ashishdhingra
Copy link
Contributor

I mean something like this
I don't need ASP pipeline like in #1688 I need a way to intercept handler calls so I can put common logic before

The design document just compares the existing old approach Vs. annotations. Configure method is typically used in context with ASP.NET applications.

Needs review with the team. CC @normj

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. label Apr 5, 2024
@normj
Copy link
Member

normj commented Apr 5, 2024

I don't have a timeline but it is a feature I would like to get in there.

@Nairda015
Copy link
Author

Do you have a vision of how you would implement it or my idea about resolving the handler from DI with the interface and adding interceptors from Castle.Core is good enough?

@ashishdhingra ashishdhingra added p2 This is a standard priority issue m Effort estimation: medium queued and removed needs-review labels Apr 5, 2024
@Nairda015
Copy link
Author

@normj will you accept PR with change to register handler with interface here?
So instead of
services.AddSingleton<<#= _model.LambdaMethod.ContainingType.Name #>>();
services.AddSingleton<I<#= _model.LambdaMethod.ContainingType.Name #>, <#= _model.LambdaMethod.ContainingType.Name #>>(); or sth like that
maybe this should be configurable from attribute idk but this will provide easy way to intercept this call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotations feature-request A feature should be added or improved. m Effort estimation: medium p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

3 participants