aws-cdk
aws-cdk copied to clipboard
aws_lambda_nodejs: Unexisting `AWS_NODEJS_CONNECTION_REUSE_ENABLED` env variable set to `1` as default
Describe the bug
The AWS SDK for JavaScript v3 is included by default in AWS Lambda Node.js 18 and Node.js 20 runtimes.
NodejsFunction
construct comes with an awsSdkConnectionReuse
optional prop, which is set to true
by default. This default automatically sets the AWS_NODEJS_CONNECTION_REUSE_ENABLED
environment variable to 1
in the Lambda function's configuration.
However, it has been identified that the AWS_NODEJS_CONNECTION_REUSE_ENABLED
environment variable does not exist in AWS SDK for JavaScript v3, rendering the variable obsolete for those utilizing the more recent Lambda runtimes. This situation not only leads to unnecessary configuration, but it also has a performance impact. The inclusion of this redundant environment variable is associated with a 20ms increase in cold start times, highlighting an opportunity for performance improvement by removing this default setting for those who do not require it.
Expected Behavior
see above
Current Behavior
see above
Reproduction Steps
see above
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.132.1
Framework Version
No response
Node.js Version
20.11.1
OS
Ubuntu 22.04.3 LTS
Language
TypeScript
Language Version
No response
Other information
No response
The new default for awsSdkConnectionReuse
should either be always false
, or:
-
false
fornodejs20.x
andnodejs18.x
-
true
fornodejs16.x
Yes I agree with your proposed solution. Making this a p1 but we welcome PRs as well.
This will actually become a moot point in just a few weeks or so. We are removing use of v2 from the CDK.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.