Every resource we deploy to AWS with CDK has some default values configured for us so that we don't have to configure everything ourselves.
This comes in handy because it allows us to focus on building our infrastructure and solving our problems instead of configuring everything.
With that being said - CDK allows us to configure various properties of our resources! In this quick lesson we're going to learn how to configure the memory size and timeout of an AWS Lambda function.
Not sure why there is a compilation error on timeout: cdk.Duration.seconds(10)
as
Types have separate declarations of a private property 'amount'.
26 timeout: cdk.Duration.seconds(10)
~~~~~~~
node_modules/@aws-cdk/aws-lambda/lib/function.d.ts:67:14
67 readonly timeout?: Duration;
~~~~~~~
The expected type comes from property 'timeout' which is declared here on type 'FunctionProps'
Does there anyone have any idea? Thanks
Hey! Is your code open source? I'd like to take a look and help :)
@quang I got the same error. Open package.json and look for the difference in versions for aws-cdk, aws-cdk/core and aws-cdk/aws-lambda. Change everything to the same verison.
For example: I had 1.222.0 for aws-cdk/aws-lambda but aws-cdk and aws-cdk/core were at 1.221.0. I changed everything by hand to 1.222.0 and that resolved the error.
Also for compatibility I started using the "cdk" binary within the node_modules dir of the project. So all my cdk commands are like this example:
$(npm bin)/cdk diff