boyney123 / cdk-eventbridge-socket

CDK construct that creates a WebSocket endpoint for you for any EventBridge rule you are interested in. (Built for debugging + testing )
https://boyney123.github.io/cdk-eventbridge-socket/
53 stars 10 forks source link

Error: Type 'App' is missing the following properties #8

Open rfc2119 opened 2 years ago

rfc2119 commented 2 years ago

Hi,

I have tried using this with latest CDK (version 2.29.0 (build 47d7ec4)) and Node 18.4 and I am always getting this error one way or the other:

/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:843                                                              
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);                                                       
           ^                                                                                                                
TSError: ⨯ Unable to compile TypeScript:                                                                                    
bin/cdk-debug-evbridge.ts:7:27 - error TS2345: Argument of type 'import("/root/cdk-debug-evbridge/node_modules/aws-cdk-lib/c
ore/lib/app").App' is not assignable to parameter of type 'import("/root/cdk-debug-evbridge/node_modules/@aws-cdk/core/lib/a
pp").App'.                                                                                                                  
  Type 'App' is missing the following properties from type 'App': onValidate, onPrepare, onSynthesize, validate, and 2 more.

7 new CdkDebugEvbridgeStack(app, 'CdkDebugEvbridgeStack', {                                                                 
                            ~~~                                                                                             

    at createTSError (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:843:12)                                    
    at reportTSError (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:847:19)
    at getOutput (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:1057:36)                                       
    at Object.compile (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:1411:41)
    at Module.m._compile (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:1596:30)                               
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Object.require.extensions.<computed> [as .ts] (/root/cdk-debug-evbridge/node_modules/ts-node/src/index.ts:1600:12)
    at Module.load (node:internal/modules/cjs/loader:988:32)                                                                
    at Function.Module._load (node:internal/modules/cjs/loader:834:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  diagnosticCodes: [ 2345 ]
}

Subprocess exited with error 1

Here's my code:

import * as cdk from '@aws-cdk/core';
import { EventBridgeWebSocket } from 'cdk-eventbridge-socket';

export class CdkDebugEvbridgeStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new EventBridgeWebSocket(this, 'CdkDebugEvbridgeSockets', {
      bus: 'default',

      // This example shows how to listen for all events
      eventPattern: {
        account: ['1234567891234'],
      },
      stage: 'dev',
    });
    // The code that defines your stack goes here

    // example resource
    // const queue = new sqs.Queue(this, 'CdkDebugEvbridgeQueue', {
    //   visibilityTimeout: cdk.Duration.seconds(300)
    // });
  }
}
MaiKaY commented 2 years ago

Hi @rfc2119, I just saw your issue while browsing through this repository, so sorry in case I miss a bit the context.

As far as I can see this construct is supposed to work with CDK v1 and not CDK v2 as in your case, so I believe that's the issue.