aws / aws/jsii-compiler

jsii crashes with internal Error when using `effect/schema`

Open
#2,391 2 comments 0 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
50
Forks
26
Avg merge
7h 10m
Merged PRs (30d)
37

Description

### Describe the bug

The following Code makes jsii crash:

```ts
import { Schema } from "effect"

export class BaseMessage extends Schema.Class("BaseMessage")({
op: Schema.String,
id: Schema.UUID,
data: Schema.Unknown
}) {}
```

`package.json`
```json
{
"name": "ommited-data",
"version": "0.0.1",
"description": "Library to validate the Ommited Messages",
"author": {
"name": "Author",
"email": "mail@example.com"
},
"repository": {
"url": "https://github.com/ommited/OMMITED-Data.git"
},
"license": "UNLICENSED",
"main": "./src/index.ts",
"scripts": {
"build": "jsii",
"build:watch": "jsii --watch",
"package": "jsii-pacmak"
},
"dependencies": {
"@effect/schema": "^0.75.5",
"effect": "^3.12.1"
},
"bundledDependencies": [
"@effect/schema",
"effect"
],
"stability": "experimental",
"types": "./dist/index.d.ts",
"jsii": {
"versionFormat": "full",
"targets": {
"dotnet": {
"namespace": "OMMITED.Data",
"packageId": "OMMITED.Data",
"versionSuffix": "-devpreview"
}
},
"outdir": "./lib",
"tsc": {
"outDir": "dist",
"rootDir": "src"
}
}
}
```

jsii Error:
```txt
error JSII9997: Unknown error: Cannot read properties of undefined (reading 'getJsDocTags') -- TypeError: Cannot read properties of undefined (reading 'getJsDocTags')
at _hasInternalJsDocTag (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1866:19)
at Assembler._isPrivateOrInternal (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1111:37)
at Assembler._visitClass (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:871:33)
at Assembler._visitNode (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:667:29)
at Assembler.emit (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:133:26)
at Compiler.consumeProgram (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:177:40)
at host.afterProgramCreate (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:71:37)
at synchronizeProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132797:12)
at updateProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132995:9)
at Timeout.updateProgramWithWatchStatus [as _onTimeout] (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132984:5)
```

This happens when running with node or bun. The above error is when running with node, despite the paths saying .bun

Running with bun produces the same error, just different wording:
```txt
error JSII9997: Unknown error: undefined is not an object (evaluating 'symbol.getJsDocTags') -- TypeError: undefined is not an object (evaluating 'symbol.getJsDocTags')
at _hasInternalJsDocTag (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1866:12)
at _isPrivateOrInternal (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1111:37)
at _visitClass (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:871:33)
at _visitNode (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:667:29)
at emit (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:133:26)
at consumeProgram (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:177:40)
at (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:71:37)
at synchronizeProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132797:12)
at createWatchProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132701:3)
at (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:82:26)
```

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

jsii compiles the code or gives an error why it can not be compiled

### Current Behavior

jsii encounters an internal error

### Reproduction Steps

Described above

### Possible Solution

Check why `base.symbol` is undefined in `jsii/lib/assembler.js:871`

### Additional Information/Context

```
jsii --version
5.7.4 (build fc2a28e), typescript 5.7.3
```

### SDK version used

5.7.4 (build fc2a28e), typescript 5.7.3

### Environment details (OS name and version, etc.)

Pop!_OS 22.04 LTS with kernel 6.9.3-76060903-generic

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the provided effect/schema example using jsii 5.7.4 and TypeScript 5.7.3. Start at jsii/lib/assembler.js:871 and inspect the path to _hasInternalJsDocTag at line 1866, focusing on why base.symbol is undefined. Done means jsii compiles the example or reports a specific supported error instead of JSII9997.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.