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

Chart.of does not recognize valid charts #401

Closed
Chriscbr opened this issue Mar 25, 2022 · 0 comments · Fixed by #402
Closed

Chart.of does not recognize valid charts #401

Chriscbr opened this issue Mar 25, 2022 · 0 comments · Fixed by #402

Comments

@Chriscbr
Copy link
Contributor

I'd be keen to work on this as we are looking to distribute a few pre-baked charts.
At the moment, when I install our package locally into a test project I get failures due to a parent chart not being found.

For some reason, Chart.of(...) fails for

import { BasicApplication } from "shared/charts" // this is locally npm-installed

class X extends Chart {
   constructor(scope: Construct, id: string) {
     super(scope, id)
    
     new BasicApplication(this, `${id}-basic`, {
        // ... props elided....
     })
  }
}

Having spent some time in the debugger, the if (c instanceof Chart) in Chart.of(thing) fails for X, even though it extends Chart.

If I inline my entire code into e.g. vendered and change the import, all is happy...

Should I open a seprate bug for 🔼 or is that something better docs might address?

Originally posted by @felipesere in cdk8s-team/cdk8s#794 (comment)

@mergify mergify bot closed this as completed in #402 Mar 29, 2022
mergify bot pushed a commit that referenced this issue Mar 29, 2022
Fixes #401 

I haven't explicitly tested this with the scenario described in #401 but I believe the root cause is the same issue described [here](aws/constructs#955). In a nutshell, "instanceof" is unreliable since it can cause issues if libraries are referencing different versions of cdk8s library in `node_modules`.

Signed-off-by: Christopher Rybicki <rybickic@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant