Skip to content

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

Open
@marvinside

Description

@marvinside

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/largeLarge work item – several weeks of effortjsiip2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions