You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey team, I'm not a TypeScript developer, so apologies for any syntax errors or missed troubleshooting steps that are in the below.
When calling cdk-import cfn -l <language> <resource>, the generated jsii_type key appears to be using the same hash for every module. Which means that when using multiple Level 1 CDK Constructs generated by cdk-import, only one of the resources are recognised. Note: This is only impacts languages other than typescript.
Generated hash: 1bc04b5291c26a46d918139138b992d2de976d6851d0893b0476b85bfbdfc6e6
Resulting in the following assembly code (for python, but similar outputs exist for other languages):
The resulting jsii_type, and generated prefix of the *.tgz file, is prefixed with the name of the resource type, and thus allows for multiple imported type modules to be used within the same CDK application.
Can we please have something like this implemented? Or alternatively have an option provided in the CLI in which we can define an override for the moduleKey?
Thanks.
The text was updated successfully, but these errors were encountered:
Have come across this issue as well. We have a CDK project that uses 3 CFN resources that are imported with cdk-import and the synth fails with an error similar to Error: Type '1bc04b5291c26a46d918139138b992d2de976d6851d0893b0476b85bfbdfc6e6.CfnApplication' not found where CfnApplication is a resource in a second imported module.
I have worked around this limitation by running a script post import to rebuild the 1bc04b5291c26a46d918139138b992d2de976d6851d0893b0476b85bfbdfc6e6 tgz file with a new name replacing all references of 1bc04b5291c26a46d918139138b992d2de976d6851d0893b0476b85bfbdfc6e6 with the new name. If i give each resource a different name it works.
Hey team, I'm not a TypeScript developer, so apologies for any syntax errors or missed troubleshooting steps that are in the below.
When calling
cdk-import cfn -l <language> <resource>
, the generatedjsii_type
key appears to be using the same hash for every module. Which means that when using multiple Level 1 CDK Constructs generated bycdk-import
, only one of the resources are recognised. Note: This is only impacts languages other thantypescript
.Looking through the
compile.ts
in thejsii-srcmak
library: https://github.com/cdklabs/jsii-srcmak/blob/main/src/compile.tsThis appears to be because the
jsii_type
key is generated using the value provided to themoduleKey
argument, else it defaults to a SHA256 hash of thebasepath
variable. However, when logging the value of thebasepath
variable, it appears as though this always defaults toindex.ts
, meaning the created hash is always the same.https://github.com/cdklabs/jsii-srcmak/blob/5c32a498d369edfb401d5e923d6255bfc21fdd91/src/compile.ts#L29
Generated hash:
1bc04b5291c26a46d918139138b992d2de976d6851d0893b0476b85bfbdfc6e6
Resulting in the following assembly code (for python, but similar outputs exist for other languages):
A workaround that I've used for this in local testing is to pass a modified version of the typeName as the 'moduleKey'.
e.g.
The resulting
jsii_type
, and generated prefix of the *.tgz file, is prefixed with the name of the resource type, and thus allows for multiple imported type modules to be used within the same CDK application.Can we please have something like this implemented? Or alternatively have an option provided in the CLI in which we can define an override for the
moduleKey
?Thanks.
The text was updated successfully, but these errors were encountered: