-
Notifications
You must be signed in to change notification settings - Fork 32
Update todos-lambda to use Lambda Runtime V2 #158
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
base: main
Are you sure you want to change the base?
Conversation
79bf7ec to
91fa2ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this Natan. I'd completely forgotten to update this example.
One thing I'd like to point out this is structured quite differently from the other examples. I think I'd like to demonstrate how easy it is to swap from server to lambda by structuring this example in a similar way to the server examples.
Can you create an App tagged with @main whose run function calls a buildApplication function in a similar manner to the other examples
|
|
||
| // Shut down the AWS client and other services after the lambda | ||
| // is done | ||
| try await app.shutdown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't get called if lambda.runService() throws an error.
In other places where I've used Soto, I've added an AWSClientService. eg
struct AWSClientService: Service {
let client: AWSClient
func run() async throws {
// Ignore cancellation error
try? await gracefulShutdown()
try await self.client.shutdown()
}
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think I'm gonna add a PR to SotoCore, which adds a trait to includes ServiceLifecycle and conforms AWSClient to Service so it can be added to the list of services and shutdown is done correctly. So if we hold off merging this we can add that change in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Let me know when it's available then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just working on it now. It'll need approval from Tim though and he seems quite busy at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its in 7.9.0
I've added a bit more comments to the todos-lambda setup. Also fixed some typos.
Ideally, I believe we should aim to update this sample project to use a Function URL instead of API Gateway, as it's simpler to setup in simpler deploys and configurations. Because I didn't want to change the SAM configuration file, I left it as it is.