aws-cdk-lib/aws-certificatemanager : dns validation custom resource lambda runtime error #29272
Labels
@aws-cdk/aws-lambda
Related to AWS Lambda
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
When creating a new dns validated certificate, there is a custom resource lambda created. This lambda errors out with "aws sdk module not found".
This might be happening because the code running on the lambda is using javascript sdk v2, but since the lambda is using the node js 20 runtime, the code needs to be updated to use the javascript sdk v3.
Expected Behavior
I expected this cdk generated lambda to complete the dns validation.
Current Behavior
2024-02-26T20:38:49.671Z undefined ERROR Uncaught Exception {
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'aws-sdk'",
"Require stack:",
"- /var/task/index.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
" at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
" at async start (file:///var/runtime/index.mjs:1282:23)",
" at async file:///var/runtime/index.mjs:1288:1"
]
}
Reproduction Steps
Here is a code snippit im using to create the certificate :
Possible Solution
Upgrading the code on this custom resource lambda to use the aws javascript sdk v3. This code is found under aws-certificatemanager/lambda-packages/dns_validated_certificate_hanlder/lib/index.js.
Additional Information/Context
No response
CDK CLI Version
2.130.0
Framework Version
No response
Node.js Version
v18.2.0
OS
Mac Sonoma 14.2.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: