Hi all, I have been using the following line in ca...
# aws
b
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
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
Same project, that code works so thank you but now I wonder why it works elsewhere
g
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
Yes, I wil dig deeper