Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdk IAspect generates: TypeError: Cannot read properties of undefined (reading 'getJsDocTags') #4569

Closed
TheFlexican opened this issue Jul 13, 2024 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@TheFlexican
Copy link

TheFlexican commented Jul 13, 2024

Describe the bug

This code generates: error JSII9997: Unknown error: Cannot read properties of undefined (reading 'getJsDocTags') -- TypeError: Cannot read properties of undefined (reading 'getJsDocTags')

I've created a projen project for aws cdk constructs, and this IAspect is part of my S3 construct, when I run npx projen build, the error is generated

export class PolicyAspect implements cdk.IAspect {
    /**
     * Visit each node in the construct tree.
     * @param node The construct node to visit.
     */
    visit(node: IConstruct): void {
      if (node instanceof cdk.aws_s3.Bucket) {
        node.addToResourcePolicy(
          new cdk.aws_iam.PolicyStatement({
            sid: 'PolicyAspectStatement',
            actions: ['s3:*'],
            effect: cdk.aws_iam.Effect.DENY,
            principals: [new cdk.aws_iam.AnyPrincipal()],
            conditions: {
              BoolIfExists: {
                'aws:PrincipalIsAWSService': 'false',
              },
              'ForAllValues:StringNotLike': {
                'aws:PrincipalOrgPath': 'ORG PATHS',
              },
            },
            resources: ["*"],
          }),
        );
      }
    }
  }

Expected Behavior

successful run.

Current Behavior

error JSII9997: Unknown error: Cannot read properties of undefined (reading 'getJsDocTags') -- TypeError: Cannot read properties of undefined (reading 'getJsDocTags')
at _hasInternalJsDocTag (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/assembler.js:1863:19)
at Assembler._isPrivateOrInternal (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/assembler.js:1108:37)
at Assembler._visitClass (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/assembler.js:868:33)
at Assembler._visitNode (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/assembler.js:664:29)
at Assembler.emit (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/assembler.js:130:26)
at Compiler.consumeProgram (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/compiler.js:178:40)
at Compiler.buildOnce (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/compiler.js:160:21)
at Compiler.emit (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/compiler.js:55:21)
at Object.handler (/home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/jsii/lib/main.js:146:75)
at /home/test/Projects/constructs/node_modules/.pnpm/[email protected]/node_modules/yargs/build/index.cjs:1:8993

Reproduction Steps

Import this into any cdk project and run jsii on the project

Possible Solution

No response

Additional Information/Context

cdkVersion: '2.149.0'
siiVersion: '~5.4.0'

SDK version used

2.149.0

Environment details (OS name and version, etc.)

Ubuntu running on WSL

@TheFlexican TheFlexican added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 13, 2024
Copy link
Contributor

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@TheFlexican
Copy link
Author

Think something is wrong on my end, need to sort that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant