-
Notifications
You must be signed in to change notification settings - Fork 429
Support dependency injection in lambda parameters #924
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @RobinVds i merged that one today - it should be in the next release before the end of the year. That said, there are better ways to test it - I often use dependency injection with ports and adapters so the handler becomes just an entry point. I can post an example later and I've been meaning to update our quick start template to demonstrate how easy it becomes for unit and Integ test |
Sounds interesting, looking forward to seeing how you implement that! 👍 |
@heitorlessa Would it be possible to post the example? Thanks! |
See if you have access to this: https://github.com/heitorlessa/aws-serverless-airline-booking/blob/refactor%2Floyalty-runtime/src/backend/loyalty/src/loyalty/aggregate/app.py#L17
I can provide more details tomorrow as I've been writing a doc for the past few days. |
Thanks for the info! If you could, please ping me when you are finished with the doc :) |
hey @RobinVds this is available now in the 1.24 release (since Dec 31st tbh ;)). I've published the talk as a PDF covering that code snippet above - slide 46 and onward for the Ports & Adapters alone: https://www.slideshare.net/HeitorLessa1/aws-community-day-ireland-refactoring-a-serverless-app Thanks a lot for raising that with us! |
This is now released under 1.25.10 version! |
Is your feature request related to a problem? Please describe.
I'm injecting my dependencies in my lambda functions to be able to easily test my functions.
Describe the solution you'd like
Would it be possible to just allow more parameters in the decorator function than only event and context? Just pass all the parameters that are included in the lambda function call.
Describe alternatives you've considered
Not relying on dependency injection and testing one level lower.
Additional context
Not sure if this way of testing lambdas is a best practice but it makes it a lot easier that's for sure.
The text was updated successfully, but these errors were encountered: