cdklabs / cdk-dynamo-table-viewer

A CDK construct which exposes an endpoint with the contents of a DynamoDB table
Apache License 2.0
125 stars 27 forks source link

Types of property 'node' are incompatible. #6

Closed include closed 5 years ago

include commented 5 years ago

Hi,

I am learning AWS-CDK and following the cdkworkshop without issues until now. So when I reach this chapter https://cdkworkshop.com/20-typescript/50-table-viewer/300-add.html after installing cdk-dynamo-table-viewer and loading this construct, I can't get further. (I don't know TS enough to debug...)

The error code I get is:

lib/cdk-workshop-stack.ts:43:35 - error TS2345: Argument of type 'this' is not assignable to parameter of type 'Construct'.
  Type 'CdkWorkshopStack' is not assignable to type 'Construct'.
    Types of property 'node' are incompatible.
      Type 'import("/Users/include/Documents/dev/myROOT/gitlab/cookielabs/z-play/aws/cdk-workshop/node_modules/@aws-cdk/core/lib/construct").ConstructNode' is not assignable to type 'import("/Users/include/Documents/dev/myROOT/gitlab/cookielabs/z-play/aws/cdk-workshop/node_modules/cdk-dynamo-table-viewer/node_modules/@aws-cdk/core/lib/construct").ConstructNode'.
        Types have separate declarations of a private property 'host'.

43         const v = new TableViewer(this, 'ViewHitCounter', {
                                     ~~~~

[10:48:17 PM] Found 1 error. Watching for file changes.

I've reviewed my code 3x to check if I had some typo or something :) but I think nop.

Can you please check this. Thank you very much.

PS: I am using your latest version. 3.0.3

Cheers, Francisco

eladb commented 5 years ago

Thanks for reporting. This is because the table viewer was still targeting the pre 1.0 CDK so there was a mismatch in versions. I've upgraded the table viewer and it should be published within an hour. Nuke your node_modules and make sure cdk-dynamo-table-viewer is 3.0.4

include commented 5 years ago

many thanks :) 🙏

jpcaparas commented 2 years ago

If you are coming from the CDK Workshop guide, simply run:

npm install cdk-dynamo-table-viewer@3.0.4

The tag versions are really weird though

jpcaparas commented 2 years ago

Actually, if you are getting:

 "The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs
14.x) while creating or updating functions.

It's better to install the 3.1 version instead:

npm install cdk-dynamo-table-viewer@3.1

As the Node.js runtime version was bumped to v12