https://pulumi.com logo
#typescript
Title
# typescript
a

astonishing-cartoon-37000

12/12/2019, 5:55 PM
has something changed with
ComponentResourceOptions
? i'm getting
Copy code
index.ts(29,47): error TS2322: Type 'Provider' is not assignable to type 'ProviderResource'.
      Types of property 'id' are incompatible.
when trying to
Copy code
const k8sProvider = new k8s.Provider(`cointainers-${environment}`, {
        kubeconfig: fs.readFileSync(`.circleci/${environment}.json`).toString()
    })

const t = new test({provider: k8sProvider}) // <---- pass provider as options to class which extends pulumi.ComponentResource

class test extends pulumi.ComponentResource {
    constructor(opts?: pulumi.ComponentResourceOptions) {
        super('test', "test", {}, opts)
    }
}
versions:
"@pulumi/pulumi": "^1.7.0",
"@pulumi/kubernetes": "^1.4.0",
this started happening after upgrading
w

white-balloon-205

12/12/2019, 6:06 PM
Hmm - does the error message also indicate the types of
id
on the two types in question?
a

astonishing-cartoon-37000

12/12/2019, 6:06 PM
yeah I get a giant stack trace
Copy code
error: Running program '/home/p/Code/ss/cointainers' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(29,47): error TS2322: Type 'Provider' is not assignable to type 'ProviderResource'.
      Types of property 'id' are incompatible.
        Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<string>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<string>'.
          Type 'Output<string>' is not assignable to type 'OutputInstance<string>'.
            Types of property 'apply' are incompatible.
              Type '{ <U>(func: (t: string) => Promise<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: string) => import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/ho...' is not assignable to type '{ <U>(func: (t: string) => Promise<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: string) => import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Ou...'.
                Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<any>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<any>'.
                  Type 'OutputInstance<any>' is not assignable to type 'Output<any>'.
                    Type 'OutputInstance<any>' is not assignable to type 'OutputInstance<any> & LiftedObject<any, string>'.
                      Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").OutputInstance<any>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").OutputInstance<any>'.
                        Types of property 'apply' are incompatible.
                          Type '{ <U>(func: (t: any) => Promise<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: any) => import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/home/p/C...' is not assignable to type '{ <U>(func: (t: any) => Promise<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: any) => import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<....'.
                            Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<any>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<any>'.
                              Type 'OutputInstance<any>' is not assignable to type 'Output<any>'.
                                Type 'OutputInstance<any>' is not assignable to type 'OutputInstance<any> & LiftedObject<any, string>'.
                                  Type 'OutputInstance<any>' is not assignable to type 'LiftedObject<any, string>'.
                                    Index signature is missing in type 'OutputInstance<any>'.
    index.ts(44,15): error TS2322: Type 'Repository' is not assignable to type 'Resource'.
      Types of property 'urn' are incompatible.
        Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<string>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<string>'.
          Type 'Output<string>' is not assignable to type 'OutputInstance<string>'.
    
        at createTSError (/home/p/Code/ss/cointainers/node_modules/ts-node/src/index.ts:261:12)
        at getOutput (/home/p/Code/ss/cointainers/node_modules/ts-node/src/index.ts:367:40)
        at Object.compile (/home/p/Code/ss/cointainers/node_modules/ts-node/src/index.ts:558:11)
        at Module.m._compile (/home/p/Code/ss/cointainers/node_modules/ts-node/src/index.ts:439:43)
        at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
        at Object.require.extensions.(anonymous function) [as .ts] (/home/p/Code/ss/cointainers/node_modules/ts-node/src/index.ts:442:12)
        at Module.load (internal/modules/cjs/loader.js:653:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
        at Function.Module._load (internal/modules/cjs/loader.js:585:3)
        at Module.require (internal/modules/cjs/loader.js:692:17)
any other information that could help? this could simply be something i'm doing wrong too XD
idk if it's related, but i'm also seeing similar issues were I pass parent to different resourceOptions.
all new since package upgrade
w

white-balloon-205

12/12/2019, 6:13 PM
Would you mind opening a GitHub issue with this stack trace so that we can look into it? I'll also suggest a way to workaround in the meantime in a second - but would love to have an issue to track fixing this as well.
a

astonishing-cartoon-37000

12/12/2019, 6:13 PM
sure! if you think it's not a user issue. I don't mind at all
I'll even test on blank project to make sure
w

white-balloon-205

12/12/2019, 6:15 PM
The thing that is leading to this is that you have two different copied of
@pulumi/pulumi
- see this:
Copy code
Type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output").Output<string>' is not assignable to type 'import("/home/p/Code/ss/cointainers/node_modules/@pulumi/pulumi/output").Output<string>'.
Note that you have one copy nested under
@pulumi/kubernetes
and one at top level in your node_modules. If you
npm upgrade @pulumi/pulumi
I suspect it will fix it - as would blowing away
node_modules
and
package-lock.json
and reinstalling dependencies.
But none of that should be necessary - as we make a lot of effort to ensure this "side-by-side" scenario (two copies of
@pulumi/pulumi
) works without problems. It looks like somehow that is not the case here - which is the issue I would like to have a bug tracking so that we can fix it.
a

astonishing-cartoon-37000

12/12/2019, 6:18 PM
I actually did
rm -rf node_modules && yarn-upgrade-all && yarn
which gave me this behavior. Wouldn't that be close to equivelent of npm ugprade
@pulumi/pulumi
and I do not track a lock file
i'll mess around a little more to make sure I can repro it in a simple fresh project
okay interestingly enough a fresh project doesn't seem to have same problem. So i'm going to dig a little more in my own project.
w

white-balloon-205

12/12/2019, 6:24 PM
okay interestingly enough a fresh project doesn't seem to have same problem.
Yes - that's what I'd expect. I'd bet in a fresh project you do not have a nested copy of
@pulumi/pulumi
inside your
@pulumi/kubernetes
package in
node_modules
. NPM/yarn is much better at unifying dependencies on fresh install than on incremental updates unfortunately.
a

astonishing-cartoon-37000

12/12/2019, 6:26 PM
omg, I had a yarn.lock hiding away
🤦‍♂️ 1
blew that away and we are gtg. wish I would of made backup so I could have told you version locks
Thank you for your time. 🙇
w

white-balloon-205

12/12/2019, 6:52 PM
Opened https://github.com/pulumi/pulumi/issues/3652 on the underlying issue.
a

astonishing-cartoon-37000

12/12/2019, 8:33 PM
awesome, thank you! I should have made the issue
l

limited-rain-96205

12/14/2019, 12:14 AM
I just ran into this issue as well after upgrading to 1.7.0, but it was with two versions of pulumi.CustomResourceOptions colliding. I moved yarn.lock somewhere else and reinstalled, and that fixed it! Thanks!
w

white-balloon-205

12/14/2019, 4:59 AM
We released 1.7.1 of
@pulumi/pulumi
with a fix for this issue earlier today - combinations of 1.7.1 with previous versions should work fine again. Thanks! https://www.npmjs.com/package/@pulumi/pulumi/v/1.7.1
23 Views