dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.16k stars 794 forks source link

Support for `runtime: provided` without requiring `useDocker` #1792

Open cnuss opened 1 month ago

cnuss commented 1 month ago

Description

This PR allows usage of runtime: provided in serverless.yml and useDocker is unset or false in custom.serverless-offline:

GET /dev/hello (λ: hello)
× Unsupported runtime
× Uncaught exception

It now uses the execa library to do a local execution of the bootstrap script:

GET /dev/hello (λ: hello)

(λ: hello) RequestId: b440ae80-b0ca-4d0d-ab6f-ea3226cb9d1a  Duration: 55.80 ms  Billed Duration: 56 ms

Motivation and Context

How this works:

Notes

How Has This Been Tested?

cnuss commented 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.

cnuss commented 1 month ago

hi @dherault and @DorianMazur it's been about a week, have you been able to take a look at this?

DorianMazur commented 3 weeks ago

Thanks for the PR @cnuss, but I'd stick with docker in this case. Let's wait for @dherault's response.