lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.84k stars 431 forks source link

nodejs14.x support #329

Open larose opened 3 years ago

larose commented 3 years ago

Thank you very much for this project. It's been very useful to me.

I noticed that nodejs14.x isn't supported. How can I add it? I found these instructions in the readme:

By tarring the full filesystem in Lambda, uploading that to S3, and then piping into Docker to create a new image from scratch – then creating mock modules that will be required/included in place of the actual native modules that communicate with the real Lambda coordinating services. Only the native modules are mocked out – the actual parent JS/PY/Java runner files are left alone, so their behaviors don't need to be replicated (like the overriding of console.log, and custom defined properties like callbackWaitsForEmptyEventLoop)

I think I understand the main steps, but I won't have the permission to upload the filesystem snapshot to lambci's s3 bucket for example. How can external collaborators contribute a new image?

ghost commented 3 years ago

Is there someone with the right permissions who can look into this? It seems like this doesn't require much work, just someone with the right permissions.

ffxsam commented 3 years ago

It would be great to have Node.js 14.x support! @mhart @sanathkr @ndobryanskyy If you & the others are too busy to maintain, would it maybe make sense to get an AWS employee to manage this repo and keep it up to date?

ofhouse commented 3 years ago

AWS already provides prebuilt build images for local Lambda emulation via it's SAM CLI framework:

Source of this images can be found here: https://github.com/aws/aws-sam-cli/blob/develop/build-image-src/Dockerfile-nodejs14x

It's bittersweet since this project provided so much value in the early days of serverless development on AWS but I think this is the way forward from now on 😔

ffxsam commented 3 years ago

The problem is, other projects depend on this one. Namely, https://github.com/dherault/serverless-offline.

So I imagine package maintainers will have to update how they run a local Lambda Docker instance.

ofhouse commented 3 years ago

Agree, it's a general problem that AWS currently eats up (namely SAM and Amplify) a lot of space where third party serverless providers like Serverless Framework exist. But the initiative to overtake or support community projects like this must come from big third-party serverless vendors, because AWS always builds its own tools rather than supporting community projects.

Unfortunately my bet in this war goes once more to AWS here because they have 1000x the resources than all vendors together, but would be happy to switch back to community projects in the future.

ghost commented 3 years ago

I've had luck using the amazon/aws-lambda-nodejs:14 image. Took a while to figure out which images were for which use cases, but I think that that is the best alternative for these images.

PatElder commented 3 years ago

I believe this is now supported

thetrevdev commented 3 years ago

I've had luck using the amazon/aws-lambda-nodejs:14 image. Took a while to figure out which images were for which use cases, but I think that that is the best alternative for these images.

This worked 👍 . If it helps anyone else there are a few differences when porting over. The default port changes to 8080, when calling the lambda it needed to be /2015-03-31/functions/function/invocations instead of /2015-03-31/functions/{*wildcard*}/invocations and make sure you have AWS_REGION set

kennyhyun commented 2 years ago

Still cannot see the dockerhub tag for nodejs14.x https://hub.docker.com/r/lambci/lambda/tags?page=1&ordering=last_updated&name=nodejs14

Is some pipeline setting missing for this?

** Please ignore this, I misunderstood something already merged for nodejs14

EcksDy commented 2 years ago

Hey @thetrevdev @PatElder @kennyhyun ! I'm trying to use serverless-offline, that depends on this repo, and still can't get nodejs14.x to work, were you guys able to make it work? Even disregarding serverless-offline, I couldn't find nodejs14 image on docker hub.

Am I missing something? Thank you 🙏

kennyhyun commented 2 years ago

I can see this PR https://github.com/lambci/docker-lambda/pull/330 is opened and approved but not merged yet. I am not sure if it's automatically published when it was merged.