I am creating new lambda functions using nodejs. And this lambda functions works well without aws-lambda. But when I require 'aws-sdk' package, it occurs the error and stop running. The error is that they can't require the 'aws-sdk' package. But aws-sdk was already in node_module folder.
I want you to solve this problem. Many thanks.
It's very interesting and strange question.
I have also experienced this issue too. At first, when I faced this problem, I was very worried and it looked really very strange. And it took me days and days of time to solve this problem.
The reason is really very simple. You meet that problem due to the timeout of lambda function.
The default timeout is 3 seconds and 3 seconds is too short time to load aws-sdk package.
To load aws-sdk package, it needs at least 6 seconds. So I recommend you to set the timeout more than 6 seconds whenever you want to use aws-sdk function.