-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: lambda timeout on create table with many columns #31329
Comments
Reproducible using below code (TypeScript): import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as redshift from '@aws-cdk/aws-redshift-alpha';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
export class RedshiftCdkStack extends cdk.Stack {
constructor(
scope: Construct,
id: string,
props?: cdk.StackProps
) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'RedshiftVpc');
const cluster = new redshift.Cluster(this, 'RedshiftCluster', {
vpc: vpc,
masterUser: {
masterUsername: 'admin'
},
removalPolicy: cdk.RemovalPolicy.DESTROY,
defaultDatabaseName: 'redshiftdb'
});
cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world');
new cdk.CfnOutput(this, 'RedShiftClusterEndpoint', {
exportName: 'RedShiftClusterEndpoint',
value: cluster.clusterEndpoint.socketAddress
});
const user = new redshift.User(this, 'RedshiftUser', {
username: 'testredshiftuser',
cluster: cluster,
databaseName: 'redshiftdb',
});
const tableColumns: redshift.Column[] = [];
tableColumns.push(
{
name: 'column_0',
dataType: 'integer',
distKey: true,
comment: 'My #0 column'
}
);
for (var i = 1; i<= 1000; i++) {
tableColumns.push({
name: `column_${i}`,
dataType: 'integer',
distKey: false,
comment: `My #${i} column`
});
}
const table = new redshift.Table(this, 'RedshiftTable', {
cluster: cluster,
databaseName: 'redshiftdb',
tableColumns: tableColumns,
distStyle: redshift.TableDistStyle.KEY,
removalPolicy: cdk.RemovalPolicy.DESTROY,
sortStyle: redshift.TableSortStyle.AUTO,
tableName: 'my_redshift_table',
tableComment: 'My first table'
});
table.grant(user, redshift.TableAction.ALL);
}
} Gives the below error during deployment:
Looking at the synthesized template, the below custom resource has timeout set to ...
"QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": "cdk-hnb659fds-assets-139480602983-us-east-2",
"S3Key": "6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717",
"Arn"
]
},
"Runtime": "nodejs20.x",
"Timeout": 60
},
"DependsOn": [
"QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D",
"QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717"
],
"Metadata": {
"aws:cdk:path": "RedshiftCdkStack/Query Redshift Database3de5bea727da479686625efb56431b5f/Resource",
"aws:asset:path": "asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2",
"aws:asset:is-bundled": false,
"aws:asset:property": "Code"
}
},
... Looks like the Perhaps the fix could be to expose |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
The problem arises while trying to create a redshift table with many columns (in the order of the hundreds) using the Table construct.
During the deployment of the resource (by the means of a CodeBuild process issuing
cdk deploy -c env=test
), I obtain the following error during the cloudformation CREATE action:The timeout error is related to a lambda generated automatically by the framework. Such timeout is by default set to 1 minute and I did not find a way to change it programmatically at runtime. Here's the code of the lambda in framework.js which raises the Exception:
Moreover, the table creation in redshfit is completed correctly (it looks like the CREATE TABLE instruction is issued and not aborted when the lambda fails), leaving the table untied to the cloudformation stack.
Here's an example of the code I am using:
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
I expect the table to be created successfully in redshift and the table to be part of the cloudformation stack.
Current Behavior
The table is created successfully in redshift but the table is not part of the cloudformation stack.
Reproduction Steps
Possible Solution
I think it is sufficient to increase the timeout for the lambda function
Additional Information/Context
No response
CDK CLI Version
2.150.0
Framework Version
No response
Node.js Version
18
OS
Ubuntu
Language
Python
Language Version
No response
Other information
I am using an EC2 instance with the following runtime provided in codebuild
aws/codebuild/standard:7.0 (Ubuntu standard:7.0)
The text was updated successfully, but these errors were encountered: