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

broad-doctor-18421

03/12/2024, 4:42 PM
I'm really confused with some tests that aren't working. As I'm getting an error:
Copy code
AssertionError: Unexpected type; expected a value of type `typing.Sequence[pulumi_aws.ec2.nat_gateway.NatGateway]` but got a value of type `<class 'dict'>` at resource `test-vpc_image`, property `nat_gateways`: {'strategy': 'None'}
Even though my test is empty. Reproducible with this repo: https://github.com/brettswift/pulumi_awsx_vpc_test Python is giving me error messages that don't make sense. Is anyone able to have a look and tell me if it's a simple issue? We've been fighting this problem for a while.
h

hundreds-gpu-71155

03/12/2024, 4:45 PM
well, a
dict
isn't a
Sequence
a
Sequence
is like a
list
or
tuple
, where you have collection of items that's ordered and indexable
but
my_dict[1]
wouldn't get you the second item, it would get you item at key
1
so i'm guessing that you used a
dict
in place of a
NatGateway
(allowed sometimes*) and forgot to wrap it in
[]
(* i believe this is allowed for inner structs that are arguments to real resources)
for more information, compare
Sequence
to
Mapping
on https://docs.python.org/3/library/collections.abc.html
b

broad-doctor-18421

03/12/2024, 5:32 PM
yea, so none of this is my code. i'm not using, nor asserting any
typing.Sequence
- it's internal to pulumi.
unfortunately, that is a bug that is a year without any activity. Concerns that the pulumi support isn't as active as I'd like
h

hundreds-gpu-71155

03/12/2024, 5:33 PM
oh cool
for the record, you don't generally use
Sequence
directly, you generally use
list
or
tuple
. and the error is that it was expecting a Sequence and didn't get one
for some reason, when I set the property on that line, i get this weird
typing.Sequence
bug.
even though I've confirmed that the right class is being supplied.
the issue linked above seems to be the problem.
h

hundreds-gpu-71155

03/12/2024, 5:35 PM
huh
so the functional fix for that looks pretty easy--add some
[]
around the call
but the typing on the
Vpc
disagrees with that
which is....exciting
b

broad-doctor-18421

03/12/2024, 5:37 PM
yea - so my guess, is that there is some kind of interop going on? I Think the underlying pulumi is typescript? So, pretty confused. For giggles, we sent the VPC a list. Obviously didn't work.
To be honest, crosswalk says doing the old way is the "hard" way - but for us - crosswalk has been the hard way as it has been getting in the way more times than not. VPC's and ALB's specifically.
h

hundreds-gpu-71155

03/12/2024, 5:38 PM
golang, not typescript
i'm currently on Azure, not AWS, so I can't comment on crosswalk, but you're not the first person to say that about awsx
b

broad-doctor-18421

03/12/2024, 5:40 PM
Well I appreciate the help - and extra set of eyes.