https://pulumi.com logo
#general
Title
# general
f

faint-motherboard-95438

05/28/2019, 11:12 AM
what did you guys change about providers ? I can’t update my platform anymore and I have no idea what I have to do to fix it. I tried to downgrade packages but I’m unable to get back to a working state…
Copy code
index.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…
b

broad-dog-22463

05/28/2019, 11:18 AM
Hi @faint-motherboard-95438, Please can you tell us what version of the providers and what version of pulumi you are using? Anything that you can do to help to try and diagnose this would be amazing
f

faint-motherboard-95438

05/28/2019, 12:01 PM
Hi @broad-dog-22463 Here’s my current dependencies related to pulumi :
Copy code
"@pulumi/gcp": "0.16.3",
    "@pulumi/kubernetes": "0.22.2",
    "@pulumi/pulumi": "0.17.6"
it seems like the signature for the
opts
key
providers
of a
ComponentResource
has changed from
<string, Provider>
to
<string, ProviderResource>
b

broad-dog-22463

05/28/2019, 12:19 PM
Thanks @faint-motherboard-95438
@stocky-spoon-28903 I’m not here long enough to know of a breaking change like this - got any insight?
f

faint-motherboard-95438

05/28/2019, 12:22 PM
I’m trying to downgrade to find at what point my code was not compatible anymore, let you know as soon as I’ll find out
s

stocky-spoon-28903

05/28/2019, 12:22 PM
@faint-motherboard-95438 which version of the CLI are you using also?
My first guess is that this is related to first class providers
f

faint-motherboard-95438

05/28/2019, 12:23 PM
the CLI gives me
v0.17.12
s

stocky-spoon-28903

05/28/2019, 12:27 PM
Hmm, do you know which package versions the program originally worked with?
f

faint-motherboard-95438

05/28/2019, 12:40 PM
I’m unfortunately unable to understand how or why it broke since I didn’t
npm i
or change anything dependency related. It was still working a few days ago.
Maybe the best way would be to go forward. What am I supposed to pass down as a
ProviderResource
to all my components ? Up until now I was passing those 2 providers :
Copy code
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,
}
Ok i see that a
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 now
@stocky-spoon-28903 I have really no idea why suddenly it is not compatible anymore, the signature seems to mismatch :
Copy code
TSError: ⨯ 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">'.
I just updated to the last version of CLI and of all dependency packages
s

stocky-spoon-28903

05/28/2019, 3:11 PM
@faint-motherboard-95438 that is strange. Is there a way you could share you code with me to help diagnose? Not sure how secret it all is, but if you could zip up your directory and send it either via slack or email that would help enormously.
If that isn’t an option I’ll work out what additional diagnostics we can run
f

faint-motherboard-95438

05/28/2019, 3:16 PM
@stocky-spoon-28903 that will be difficult to provide you with all our code, but I can give you some relevant parts so that could be useful for you to understand what’s going on (that’s actually pretty simple since passing down a
Provider
to any component fails during the TS compilation with the previous error)
s

stocky-spoon-28903

05/28/2019, 3:20 PM
Ah yes, if you have a minimal repro then that’s even better
b

big-piano-35669

05/28/2019, 4:51 PM
Provider
subclasses
ProviderResource
, AFAIK, so it should be substitutable. Based on the error
Copy code
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
Copy code
{
    "gcp": new gcp.Provider(),
    "kubernetes": new k8s.Provider(),
}
rather than
Copy code
{
    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.
f

faint-motherboard-95438

05/29/2019, 7:54 AM
Hi @big-piano-35669 and @stocky-spoon-28903, I never had any problems with the way the code was written before (it worked for months). I’ve finally succeeded to have it working by trashing all
node_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.
2 Views