Open johntaormina opened 1 year ago
We were able to work around the error by completely removing the "exports"
section from the package.json - this allowed the JSII Assembly
jsii.JSIIAssembly.load()
to not fail.
However, we would still like to use "exports" in the future
Describe the bug
Using JSII to compile a TS/JS library into Python, and importing the library into a Python CDK application is failing when attempting to run any
cdk
commands. The failure response returned is:The Library Package is created using
The package.json contains
as well as various exports of each sub-package similar to aws-cdk-lib like so
Expected Behavior
I expect
cdk synth
to synthesize the Python CDK code into a CloudFormation template by compiling/processing the Javascript artifact through the Python interface.Current Behavior
When using the JSII translated library in Python, the Interfaces are all read correctly. However, at the time of compiling the Javascript package when running
cdk
commands... the compilation fails with the error messageReproduction Steps
Create CDK Construct Library Using JSII
Import Library into Python CDK Application
mkdir python-test-app
&&cd python-test-app
cdk init app --language python
cdk synth
Possible Solution
The main suspect is the package.json file, as the error clearly mentions it not containing
"exports" main
. There is nothing within our pacakge.json that seems to be incorrect or misaligned from other libraries.Additional Information/Context
For security purposes, I have not included the full contents of any file. Please follow up with any questions regarding files for information. This library has been confirmed to work for TS and Go applications, however has not worked for Python.
SDK version used
"jsii": "~5.0.0","jsii-pacmak": "^1.83.0","aws-cdk-lib": "2.92.0", "constructs": "10.1.243","typescript": "^5.1.3"
Environment details (OS name and version, etc.)
Mac on Venture. Python Versions 3.7, 3.8, 3.10, 3.11 using venv