jeremydaly / lambda-warmer

A module to optimize AWS Lambda function cold starts
MIT License
525 stars 55 forks source link

lambda-warmer ignores value of AWS_LAMBDA_FUNCTION_VERSION #58

Closed CH43-dev closed 11 months ago

CH43-dev commented 1 year ago

Hi! After upgrade to version 2.0.0 (because of AWS SDK v3 support) it was necessary to change our IAM policy because lambda-warmer is ignoring the value of AWS_LAMBDA_FUNCTION_VERSION. The value will still be used to create the log-record but it will be ignored afterwards:

... const funcName = process.env.AWS_LAMBDA_FUNCTION_NAME const funcVersion = process.env.AWS_LAMBDA_FUNCTION_VERSION ... // Create log record let log = { action: 'warmer', function: funcName + ':' + funcVersion, ... I think the functionality is changed since version 1.3.0 – support multiple targets. Is this the expected behavior?

naorpeled commented 1 year ago

Hey @CH43-dev, I'll be honest and say I'm not sure, need to refresh my memory.

Will be able to take a look on Friday, I hope that's okay 🙏

CH43-dev commented 1 year ago

Hi @naorpeled,

In version 1.2.3, lambda-warmer has used funcName + ':' + funcVersion as FunctionName. Since version 1.3.0 it is using target -> let target = event[config.target] || funcName

naorpeled commented 11 months ago

I've merged a PR that resolves this issue, will mark this issue as resolved.

Please let me know if something is still off.