awslabs / aws-rails-provisioner

Define and deploy containerized Ruby on Rails Applications on AWS
Apache License 2.0
200 stars 19 forks source link

Typescript error #20

Open chrisgeek opened 3 years ago

chrisgeek commented 3 years ago

Using ruby 2.5.1 Rails 5.1

when I try to build, I get the following error

`lib/inventory-fargate-stack.ts:37:43 - error TS2339: Property 'ClusterParameterGroup' does not exist on type 'typeof import("/home/chrisgeek/Documents/RailsProjects/inventory/cdk-sample/node_modules/@aws-cdk/aws-rds/lib/index")'.

37         const clusterParameterGroup = rds.ClusterParameterGroup.fromParameterGroupName(
                                             ~~~~~~~~~~~~~~~~~~~~~

lib/inventory-fargate-stack.ts:42:13 - error TS2345: Argument of type '{ engine: rds.IClusterEngine; masterUser: { username: string; password: cdk.SecretValue; }; instanceProps: { instanceType: ec2.InstanceType; vpc: ec2.IVpc; vpcSubnets: { ...; }; }; defaultDatabaseName: string; removalPolicy: cdk.RemovalPolicy.RETAIN; instances: number; parameterGroup: any; }' is not assignable to parameter of type 'DatabaseClusterProps'.
  Object literal may only specify known properties, and 'masterUser' does not exist in type 'DatabaseClusterProps'.

42             masterUser: {
               ~~~~~~~~~~~~~
43                 username: username,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44                 password: password
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45             },
   ~~~~~~~~~~~~~

Found 2 errors`

I am not sure how to resolve this, I tried on a different project and the errors were over 20.

mullermp commented 3 years ago

I recall this being fixed: https://github.com/awslabs/aws-rails-provisioner/issues/14

I think maybe I didn't release a new version after the fix? Do you mind cloning the repo and migrating your rails app that way? I can also plan to re-release a new pre version.

mullermp commented 3 years ago

https://github.com/awslabs/aws-rails-provisioner/releases/tag/v0.0.2.rc4

I've pushed a new release that should have fixed this. Let me know if you still have troubles.

chrisgeek commented 3 years ago

OK, let me install and check

chrisgeek commented 3 years ago

I get this error now

  Object literal may only specify known properties, and 'masterUser' does not exist in type 'DatabaseClusterProps'.

42             masterUser: {
               ~~~~~~~~~~~~~
43                 username: username,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44                 password: password
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45             },
   ~~~~~~~~~~~~~

Found 1 error.
mullermp commented 3 years ago

Possibly another breaking CDK change :/

mullermp commented 3 years ago

https://github.com/aws/aws-cdk/releases/tag/v1.65.0

It looks like this is the change:

rds: DatabaseClusterProps masterUser renamed to credentials.

Luckily I think this is an easy fix. You should be able to modify that generated code and continue running it.

Alternatively, pin to an older version of CDK (1.64.0)

chrisgeek commented 3 years ago

This fixed the issue rds: DatabaseClusterProps masterUser renamed to credentials.

Pinning to 1.64.0 didn't. Thanks @mullermp

yopaz-giapnh commented 3 years ago

Is this fixed? I still got the same error.

yopaz-giapnh commented 2 years ago

This error occurs if using Node14, switching to node 12 works fine. But this problem needs to be fixed.