faint-motherboard-95438
05/28/2019, 11:12 AMindex.ts(109,5): error TS2322: Type '{ gcp: Provider; kubernetes: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
index.ts(134,5): error TS2322: Type '{ gcp: Provider; kubernetes: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
index.ts(170,5): error TS2322: Type '{ gcp: Provider; kubernetes: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
index.ts(188,5): error TS2322: Type '{ gcp: Provider; kubernetes: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
I’m creating providers for gcp and kubernetes with new gcp.Provider()
and new k8s.Provider()
from @pulumi/gcp
and @pulumi/kubernetes
respectively and I’m passing them down in all my components opts
argument.
Everything was perfectly working before…broad-dog-22463
05/28/2019, 11:18 AMfaint-motherboard-95438
05/28/2019, 12:01 PM"@pulumi/gcp": "0.16.3",
"@pulumi/kubernetes": "0.22.2",
"@pulumi/pulumi": "0.17.6"
opts
key providers
of a ComponentResource
has changed from <string, Provider>
to <string, ProviderResource>
broad-dog-22463
05/28/2019, 12:19 PMfaint-motherboard-95438
05/28/2019, 12:22 PMstocky-spoon-28903
05/28/2019, 12:22 PMfaint-motherboard-95438
05/28/2019, 12:23 PMv0.17.12
stocky-spoon-28903
05/28/2019, 12:27 PMfaint-motherboard-95438
05/28/2019, 12:40 PMnpm i
or change anything dependency related. It was still working a few days ago.ProviderResource
to all my components ?
Up until now I was passing those 2 providers :
const k8sProvider = new k8s.Provider(
`${prefix}-k8s-provider`,
{ kubeconfig: clusterStack.getOutput('kubeConfig') },
)
const gcpProvider = new gcp.Provider(
`${prefix}-gcp-provider`,
{
credentials: gcpStack.getOutput('clusterAdminKey'),
project: gcp.config.project,
zone: gcp.config.zone,
region: gcp.config.region,
},
)
const providers = {
gcp: gcpProvider,
kubernetes: k8sProvider,
}
Provider
is extended from a ProviderResource
, so that should be ok as it has always be, I don’t understand why I have a ts error nowTSError: ⨯ Unable to compile TypeScript:
index.ts(41,5): error TS2322: Type '{ gcp: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
Property 'gcp' is incompatible with index signature.
Type 'Provider' is not assignable to type 'ProviderResource'.
Types of property 'id' are incompatible.
Type 'import("/[...]/node_modules/@pulumi/gcp/node_modules/@pulumi/pulumi/output").Output<string>' is not assignable to type 'import("/[...]/node_modules/@cappalyst/pulumi/node_modules/@pulumi/pulumi/output").Output<string>'.
Property 'length' is missing in type 'Output<string>' but required in type 'LiftedObject<String, number | "length">'.
index.ts(83,5): error TS2322: Type '{ gcp: Provider; }' is not assignable to type 'Record<string, ProviderResource>'.
Property 'gcp' is incompatible with index signature.
Type 'Provider' is not assignable to type 'ProviderResource'.
Types of property 'id' are incompatible.
Type 'import("/[...]/node_modules/@pulumi/gcp/node_modules/@pulumi/pulumi/output").Output<string>' is not assignable to type 'import("/[...]/node_modules/@pulumi/pulumi/output").Output<string>'.
Property 'length' is missing in type 'Output<string>' but required in type 'LiftedObject<String, number | "length">'.
stocky-spoon-28903
05/28/2019, 3:11 PMfaint-motherboard-95438
05/28/2019, 3:16 PMProvider
to any component fails during the TS compilation with the previous error)stocky-spoon-28903
05/28/2019, 3:20 PMbig-piano-35669
Provider
subclasses ProviderResource
, AFAIK, so it should be substitutable. Based on the error
Type '{ gcp: Provider; kubernetes: Provider; }' is not assignable to type 'Record<string, ProviderResource>'
I wonder, are gcp
and kubernetes
strings? In other words, something like this
{
"gcp": new gcp.Provider(),
"kubernetes": new k8s.Provider(),
}
rather than
{
gcp: new gcp.Provider(),
kubernetes: new k8s.Provider(),
}
Just a guess based on the errors. If this isn't it, then a minimal repro would definitely help.faint-motherboard-95438
05/29/2019, 7:54 AMnode_modules
, brew uninstall pulumi
, removed all plugins and reinstalled everything to the latest version.
That’s a weird issue that things get messy like that without having changed anything on my side. That’s not the first time though I have issues related to an minor package upgrade an inconsistency between a pulumi node module and a pulumi plugin related to the CLI.