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

bitter-zebra-93800

06/10/2020, 4:09 PM
Hi all, I have been using the following line in calls to new aws.ec2.Instance(
Copy code
subnetId: vpc.publicSubnetIds[0], // use the subnet(s) from awsx.ec2.Vpc
It works fine in 3 of my stacks with identical vpcs but on a new on it gives this error
Copy code
Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'Promise<Output<string>[]>'.
  Property '0' does not exist on type 'Promise<Output<string>[]>'.
I am baffled by it, if I copy index.ts to a new name it does not show the error. Any help greatly appreciated.
g

gentle-diamond-70147

06/10/2020, 4:20 PM
Are you getting this different behavior across different projects or different stacks of the same project? The AWSX output types did change a while back so I suspect you were on a previous version and updated recently. You need to use the publicSubnetIds output like this in the latest AWSX version:
Copy code
subnetId: pulumi.output(vpc.publicSubnetIds.then(ids => ids[0])),
b

bitter-zebra-93800

06/10/2020, 4:22 PM
Same project, that code works so thank you but now I wonder why it works elsewhere
g

gentle-diamond-70147

06/10/2020, 4:24 PM
That is strange. Is this all on the same machine too? If so, it should be using the same
package-lock.json
to keep the stacks all on the same versions.
b

bitter-zebra-93800

06/10/2020, 4:59 PM
Yes, I wil dig deeper
3 Views