jeremydaly / lambda-warmer

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

TypeError: lambda.invoke(...).promise is not a function #3

Open aljanson opened 5 years ago

aljanson commented 5 years ago

Hello,

I followed the tutorial and added the code (via the callback technique) to my existing lambda function.

I created a test event on the lambda with the following event object: { "warmer":true,"concurrency":3 }

When i executed the test, it failed with the following error traced on Cloudwatch:

TypeError: lambda.invoke(...).promise is not a function
at module.exports (/var/task/node_modules/lambda-warmer/index.js:94:48)

When i changed the concurrecy value to 1, it worked fine and returned "warmer" as the callback message (based on the default tutorial example). And i am assuming this is because we just return a Promise.resolve(true) when the concurrency is 1.

I read about this error in other posts and some people mentioned setting the API version for the SDK. But looking at nobody else had this issue, I am wondering I might have made a very obvious blunder and would appreciate some guidance regarding this.

Thanks!

jeremydaly commented 5 years ago

Hi @aljanson. What version of the SDK are you using?

aljanson commented 5 years ago

Hey @jeremydaly

Had a look at the package.json, it shows: "aws-sdk": "2.2.48"