dherault / serverless-offline

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

Workaround for node 18 and using docker? #1688

Closed OscBacon closed 4 months ago

OscBacon commented 1 year ago

Hi, Is there any workaround or tipe for using node 18 and testing with useDocker?

fahimuddin-brillmark commented 1 year ago

@OscBacon Seems like I am having the same issue, cannot use lambda layers in serverless-offline. Looks like the base image of docker used by serverless-offline for Node 18 is deprecated : https://github.com/lambci/docker-lambda for https://github.com/aws/aws-lambda-base-images

Hopefully team responds soon with some workarounds.

davidjb commented 1 year ago

serverless-offline is currently using lambci images for Docker, as @fahimuddin-brillmark mentioned, which were abandoned a long while ago and haven't been updated in years. Serverless itself is in the same situation with its serverless invoke local - it is still currently using lambci too. I did a write-up about what it would take to update that codebase to using the latest AWS images and feel it's pretty relevant here too: https://github.com/serverless/serverless/issues/10797#issuecomment-1544922990

Key takeaways are that the mapping a handler to a Lambda runtime container isn't just as simple as a string replacement or templating any longer (requiring a bit of logic), and the internals workings of the containers are understandably different.

My use case was looking at getting Go working under provider.al2 (the current runtime since go1.x is EOL), and as with Serverless itself, some work would be needed to make serverless-offline compatible, although I did start with #1691.

manfioLP commented 7 months ago

thanks @davidjb - helped me a lot :)

DorianMazur commented 4 months ago

@OscBacon @davidjb @manfioLP @fahimuddin-brillmark This should now be fixed. I just merged a PR that solves this issue - #1755