swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.12k stars 101 forks source link

Replacement for Lambda.run? #279

Closed mattmassicotte closed 3 months ago

mattmassicotte commented 1 year ago

I've noticed that I can no longer use Lambda.run. Docs haven't been updated yet and I'm now struggling to figure out how to use the library now. I have noticed there has not been a new release, so perhaps things are still in progress?

Normally, I'd just stick with the latest release. But, I'm working on adding a new event from Cognito. I'd prefer to work with the desired future APIs and that new repo. Does that make sense?

Thank you!

sebsto commented 1 year ago

You can now extend SimpleLambdaHandler and overwrite

  func handle(_ event: Event, context: AWSLambdaRuntimeCore.LambdaContext) async throws -> Output { ... }

Here are two working examples on a work branch :

HttpApi : https://github.com/swift-server/swift-aws-lambda-runtime/pull/278/files#diff-d3a9439a759f16f71aa24fe566ecaace7f888a68a91d6784de2fa25bde248136

SQS : https://github.com/swift-server/swift-aws-lambda-runtime/pull/278/files#diff-75dbefb5d87f100caceb006a6afecf71124c6d0a38893a5976b1c5ff8e32e542

tomerd commented 1 year ago

made this PR to document the 1.x API. once merged we can tag a 1.0.0-alpha.1

mattmassicotte commented 1 year ago

Thanks to both of you! Those examples are great, and I'm sure docs will be awesome too.

Joannis commented 3 months ago

Hey @mattmassicotte , we're closing this issue since it's been over a year since filing. If you or anyone else still has a question on this topic, let us know!

mattmassicotte commented 3 months ago

I probably should have closed this myself a while ago. Thanks again!