claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

Add no-handler-update command-line option to omit updating the handler on Lambda #239

Open aarsilv opened 2 years ago

aarsilv commented 2 years ago

This PR adds a new option, --no-handler-update which omits updating the handler on Lambda. The use case that prompted this PR is we deploy using Claudia, but have a Datadog layer. Thus Claudia's validation needs to use one handler, lib/lambda.handler, while the Lambda configuration needs to point the the Datadog wrapper handler, /opt/nodejs/node_modules/datadog-lambda-js/handler.handler. With this new command line argument we are able to satisfy the above with

claudia update --handler="lib/lambda.handler" --no-handler-update

While testing, I also discovered that the AWS API returns State with a capital "S", while Claudia was looking for lower-case. I adjusted this to match the response so that existing tests passed instead of failed. Should fix: #226