{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '@aws-sdk/client-redshift-data'\nRequire stack:\n- /var/task/redshift-data.js\n- /var/task/privileges.js\n- /var/task/index.js\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '@aws-sdk/client-redshift-data'",
"Require stack:",
"- /var/task/redshift-data.js",
"- /var/task/privileges.js",
"- /var/task/index.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:997:17)",
" at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1032:21)",
" at async start (file:///var/runtime/index.mjs:1195:23)",
" at async file:///var/runtime/index.mjs:1201:1"
]
}
Describe the bug
The DatabaseQuery handler in @aws-cdk/aws-redshift-alpha uses AWS SDK v3 but is set to run in the Node14 runtime. This leads to a crash at runtime where the lambda cannot find SDK v3.
Expected Behavior
The lambda should execute without error
Current Behavior
In #25895, all alpha modules were updated to use AWS SDK v3, but a handler defined in the aws-redshift-alpha module (https://github.com/aws/aws-cdk/blob/6c75581ae2b9537fa9d1d724b837fe81ae22d345/packages/%40aws-cdk/aws-redshift-alpha/lib/private/database-query.ts) uses Node 16. This leads to this error:
Possible Solution
CDK CLI Version
2.87.0
Node.js Version
18
OS
Linux
Language
Typescript