Open cnuss opened 1 month ago
Hi @dherault and @DorianMazur this PR might stir up some debate, so let me know what you think!
Long story short, I never liked the requirement to have Docker to run serverless applications that have a compiled binary. It also caused long-ish first-runs of a lambda function as it downloads and runs the base container and layers.
I found myself wishing Docker wasn't involved in the execution of the bootstrap
script, so I decided to make this PR.
hi @dherault and @DorianMazur it's been about a week, have you been able to take a look at this?
Thanks for the PR @cnuss, but I'd stick with docker in this case. Let's wait for @dherault's response.
Description
This PR allows usage of
runtime: provided
inserverless.yml
anduseDocker
is unset or false incustom.serverless-offline
:It now uses the
execa
library to do a local execution of thebootstrap
script:Motivation and Context
bootstrap
script without launching it inside a docker containerdelve
)How this works:
runtime: provided
anduseDocker: false|undefined
, will create aRuntimeServer
on a random port, and set theAWS_LAMBDA_RUNTIME_API
environment variable so that thebootstrap
script can interact with it./response
is called, theevent
is cleared from theRuntimeServer
so subsequent invocations of/next
indefinitely block.Notes
RuntimeServer
per invocation:RuntimeServer
could be shared by setting theAWS_LAMBDA_RUNTIME_API
environment variable to be:http://localhost:${some-non-random-port}/function-name
instead ofhttp://localhost:${some-random-port}
useDocker: false
orundefined
and there arelayers
on the functionHow Has This Been Tested?
./tests/integration/docker/provided
to./tests/lambda-run-mode/provided
useDocker: true
and began development until it worked