feral icon indicating copy to clipboard operation
feral copied to clipboard

feat: lambda custom runtime

Open i10416 opened this issue 1 year ago • 2 comments

part of https://github.com/typelevel/feral/issues/134

This commit resumes https://github.com/typelevel/feral/pull/276/ with some modifications.

The main differences between this commit and the PR above are the followings;

in terms of module structure,

  • The original feral-lambda module is split into feral-lambda-kernel and feral-lambda-runtime-binding
    • feral-lambda-kernel contains types shared across runtime
    • feral-lambda-runtime-binding contains facades for AWS Java and JS runtimes
  • AWS Runtime API stuffs are moved under runtime.api package
    • correcting Lambda-Runtime-Client-Identity to Lambda-Runtime-Cognito-Identity
    • adding LambdaRuntimeAPIClient that wraps http4s Client
  • Scala Native support is not included in the commit

in terms of behaviors,

  • ~the runtime runs next invocation calls and handlers in parallel~ edit: runtime should not run handlers in parallel.
  • the runtime will terminate when Lambda Runtime API returns 500, which implies unrecoverable container error

See also

  • https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html

Co-Authored-By: Scott Thomson

i10416 avatar Jul 08 '24 16:07 i10416

the runtime runs next invocation calls and handlers in parallel

Are you sure that AWS Lambda actually support this? i.e. will the GET request for the next event return something different before you POST the result? If so, that would be violating HTTP method semantics.

armanbilge avatar Jul 08 '24 18:07 armanbilge

https://github.com/typelevel/feral/pull/496#discussion_r1669120978

I think we should avoid running handlers in parallel... Sorry for confusion😢

i10416 avatar Jul 08 '24 18:07 i10416