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

jsii crashes with internal Error when using effect/schema #4755

Open
1 task
marvinside opened this issue Jan 27, 2025 · 1 comment
Open
1 task

jsii crashes with internal Error when using effect/schema #4755

marvinside opened this issue Jan 27, 2025 · 1 comment
Labels
bug This issue is a bug. effort/large Large work item – several weeks of effort jsii p2

Comments

@marvinside
Copy link

Describe the bug

The following Code makes jsii crash:

import { Schema } from "effect"

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

package.json

{
  "name": "ommited-data",
  "version": "0.0.1",
  "description": "Library to validate the Ommited Messages",
  "author": {
    "name": "Author",
    "email": "[email protected]"
  },
  "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:

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:

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 <anonymous> (/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 <anonymous> (/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

@marvinside marvinside added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 27, 2025
@otaviomacedo otaviomacedo added effort/large Large work item – several weeks of effort p2 jsii and removed needs-triage This issue or PR still needs to be triaged. labels Jan 31, 2025
@otaviomacedo
Copy link
Contributor

This example involves interfaces with construct signatures, and a very complex hierarchy. This use case was probably not taken into account when jsii was designed, and this will require a deep dive. Marking this

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. effort/large Large work item – several weeks of effort jsii p2
Projects
None yet
Development

No branches or pull requests

2 participants