boyney123 / boyney123/cdk-eventbridge-socket

Error: Type 'App' is missing the following properties

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
52
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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. [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:
```typescript
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)
// });
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with bin/cdk-debug-evbridge.ts and compare its @aws-cdk/core import with the aws-cdk-lib version shown in the error. Reproduce the TypeScript compilation failure using the provided Node and CDK versions, then verify that the example stack compiles without the App type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.