Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@aws-cdk/aws-redshift-alpha: Custom resource unable to find AWS SDK v3 #26397

Closed
internetdhruv opened this issue Jul 18, 2023 · 2 comments · Fixed by #26406
Closed

@aws-cdk/aws-redshift-alpha: Custom resource unable to find AWS SDK v3 #26397

internetdhruv opened this issue Jul 18, 2023 · 2 comments · Fixed by #26406
Labels
@aws-cdk/aws-redshift Related to Amazon Redshift bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@internetdhruv
Copy link

internetdhruv commented Jul 18, 2023

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:

{
    "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"
    ]
}

Possible Solution

CDK CLI Version

2.87.0

Node.js Version

18

OS

Linux

Language

Typescript

@internetdhruv internetdhruv added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2023
@github-actions github-actions bot added the @aws-cdk/aws-redshift Related to Amazon Redshift label Jul 18, 2023
@pahud
Copy link
Contributor

pahud commented Jul 18, 2023

related #26212

@pahud pahud added investigating This issue is being investigated and/or work is in progress to resolve the issue. p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2023
MrArnoldPalmer added a commit that referenced this issue Jul 18, 2023
Fixes the database-query custom resource in redshift alpha to correctly
use Node18 as the runtime version since it now uses sdk v3.

Fixes: #26397
@pahud pahud removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jul 18, 2023
@mergify mergify bot closed this as completed in #26406 Jul 18, 2023
mergify bot pushed a commit that referenced this issue Jul 18, 2023
Fixes the database-query custom resource in redshift alpha to correctly use Node18 as the runtime version since it now uses sdk v3.

Fixes: #26397

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️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.

bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this issue Jul 29, 2023
Fixes the database-query custom resource in redshift alpha to correctly use Node18 as the runtime version since it now uses sdk v3.

Fixes: aws#26397

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-redshift Related to Amazon Redshift bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants