https://pulumi.com logo
Title
c

cuddly-actor-99406

04/30/2021, 2:41 AM
just upgraded to pulumi 3.1 from 2.x and
pulumi up
now throws with a not very useful stack trace. It's throwing from
pulumi.runtime.rpc.serialize_property
. I put in some debug print statements and I think it is
k8s.yaml.ConfigFile
which is the resource involved. It looks like it might be related to something in the upgrade notes "*snake_case/camelCase Key Translation Fixes in Provider Python SDKs*". Can anyone help?
more info:
Have you read the migration doc?
c

cuddly-actor-99406

04/30/2021, 2:50 AM
yes; can't see anything I have to do in my code.
r

red-match-15116

04/30/2021, 2:51 AM
The stacktrace would be helpful. What version of python are you using?
c

cuddly-actor-99406

04/30/2021, 2:56 AM
python is 3.9.1
File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 438, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 120, in prepare_resource
        provider_urn = await provider.urn.future()
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 438, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 120, in prepare_resource
        provider_urn = await provider.urn.future()
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 438, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 120, in prepare_resource
        provider_urn = await provider.urn.future()
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 116, in get_value
        val = await self._future
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 116, in get_value
        val = await self._future
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 116, in get_value
        val = await self._future
      [Previous line repeated 30 more times]
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 67, in rpc_wrapper
        result = await rpc
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 91, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 91, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/output.py", line 91, in is_value_known
        return await is_known and not contains_unknowns(await future)
      [Previous line repeated 6 more times]
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 438, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 100, in prepare_resource
        serialized_props = await rpc.serialize_properties(props, property_dependencies_resources, translate, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 121, in serialize_properties
        result = await serialize_property(v, deps, input_transformer, get_type(k))
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 256, in serialize_property
        value = await serialize_property(output.future(), deps, input_transformer, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 243, in serialize_property
        return await serialize_property(future_return, deps, input_transformer, typ)
      File "/myproject/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 308, in serialize_property
        raise AssertionError(f"Unexpected type. Expected 'dict' got '{typ}'")
    AssertionError: Unexpected type. Expected 'dict' got '<class 'str'>'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
r

red-match-15116

04/30/2021, 3:05 AM
I think this is what you’re running into: https://github.com/pulumi/pulumi/issues/6818
But I have no idea what’s in your code so I can’t be sure.
c

cuddly-actor-99406

04/30/2021, 4:47 AM
I found one in my code, this is the fix:
--- k8s.Provider('k8s-provider', kubeconfig=cluster.kubeconfig, suppress_deprecation_warnings=True)
+++ k8s.Provider('k8s-provider', kubeconfig=cluster.kubeconfig.apply(lambda i: str(i)), suppress_deprecation_warnings=True)
That's a breaking change from 2.x without a useful error message. It now requires an explicit cast from "Any" (presumably a dict in this case) to str, which is kinda clumsy. And I'm narrowing down the ones in k8s that I don't believe are caused by my code. This is standard k8s yaml (running in production) using
k8s.yaml.ConfigFile
that is throwing this :
AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType]'
I have no idea how to go about fixing that.
r

red-match-15116

04/30/2021, 4:51 AM
So, two things. The first point about the dict/string can you please update this issue with your details and upvote it? I consider that a regression and we need to fix that behavior. The latter, I think that might be the issue described here: https://pulumi-community.slack.com/archives/CDE799L1M/p1619687320187000
c

cuddly-actor-99406

04/30/2021, 5:06 AM
I have done as requested on the first point. Re the second, I though initially that the
remove_crds_status
code was related, because I am indeed using that workaround. But in addressing this bug, I commented out any transforms, and progressively commented out yaml elements to narrow it down. pulumi processes a lot of yaml before it throws; here is the element path that will throw if uncommented, and succeed if commented
r

red-match-15116

04/30/2021, 7:12 AM
I recognize that you are hitting the error from a different entry point, but I meant that it is probably a similar issue because you are getting the same error message related to the same type, i.e.
pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs
. Again, I would encourage you to add your information to that issue because it could help the team fix the bug, help prioritize, etc.
c

cuddly-actor-99406

04/30/2021, 7:47 AM
Oh, yeah, sorry. I didn't see the reply to that thread you linked. Totally the same error. I'll follow it there. Thanks for your help.
👍🏽 1