Search code examples
typescriptamazon-s3aws-glueaws-cdk

Passing IBucket to bucket property in Table props results in missing property error


s3Bucket = s3.Bucket.fromBucketName(this, bucketName, bucketName);
let glueTable = new glue.Table(this, tableName, {
                database: glueDb,
                tableName: tableName,
                bucket: s3Bucket
})

The IDE throws this error when I pass s3bucket to the bucket property. Can you please help me identify what is causing the error?

Type 'IBucket' is missing the following properties from type 'IBucket': virtualHostedUrlForObject, grantPutAcl, envts(2739) table.d.ts(105, 14): The expected type comes from property 'bucket' which is declared here on type 'TableProps'


Solution

  • This error usually comes when you have mismatch in versions of cdk modules. Try to update version of s3 and glue to latest cdk version(1.91.0).

    For me with below versions it is not giving any error in IDE. "@aws-cdk/aws-s3": "1.91.0", "@aws-cdk/aws-glue": "1.91.0",