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

millions-judge-24978

11/18/2019, 10:23 PM
Hi, I am getting
warning: Synchronous call made to "aws:index/getAvailabilityZones:getAvailabilityZones" with an unregistered provider.
I do not have any calls to this in my code. Would it be possible to get this warning from
new awsx.ec2.Vpc(...)
potentially?
w

white-balloon-205

11/18/2019, 10:24 PM
Perhaps - the latest versions of that library should avoid this. What version of
@pulumi/awsx
are you using?
m

millions-judge-24978

11/18/2019, 10:25 PM
1.9.0 Woops that was aws not awsx
@pulumi/awsx@0.18.13
w

white-balloon-205

11/18/2019, 10:26 PM
Could you share the snippet where you construct
new awsx.ec2.Vpc
? Do you pass a
provider:
?
m

millions-judge-24978

11/18/2019, 10:27 PM
Yes I do,
Copy code
const provider = new aws.Provider(name, { region }, {
      aliases: [{name: `provider-${region}`}, { name }],
    });

    const defaultOpts: pulumi.ComponentResourceOptions = { parent: this, provider };

    const vpc = new awsx.ec2.Vpc(name, {
      cidrBlock: cidrBlock || '10.0.0.0/16',
      tags: {
        Name: name,
      },
      subnets: [{
        type: 'public',
        tags: {
          '<http://kubernetes.io/role/elb|kubernetes.io/role/elb>': '1',
        },
        ignoreChanges: ["tags"],
      }, {
        type: 'private',
        tags: {
          '<http://kubernetes.io/role/internal-elb|kubernetes.io/role/internal-elb>': '1',
        },
        ignoreChanges: ["tags"],
      }],
      numberOfAvailabilityZones: 3,
    }, defaultOpts);
I’m hoping there’s some way to do the equivalent of the
async: true
if it is coming from
awsx
w

white-balloon-205

11/18/2019, 10:29 PM
In that case you may need to do what the docs linked from that warning suggest: https://www.pulumi.com/docs/troubleshooting/#register-the-provider-first That said - I'm surprised you would need this in your case - I'll need to look a little deeper to understand why you would see this.
m

millions-judge-24978

11/18/2019, 10:29 PM
Dang, yeah I was hoping to avoid that, a bit tricky since I’m instantiating the provider in a constructor
Could be a bad idea but wrapping the whole body of the constructor in a
Copy code
(async () => {
  ...
})()
seems to work and gets rid of the warnings
Not sure if that could cause any issues with
this.registerOutputs
or anything else
w

white-balloon-205

11/18/2019, 10:36 PM
Yes - you can do that. The only issue will be if you set any properties on the class your constructor is for, if so, those properties will be undefined for some period of time after the constructor completes. If that's okay for you use case, then the above is fine. Could you open an issue on this in the
awsx
repo? Definitely want to ensure this isn't the default experience.
m

millions-judge-24978

11/18/2019, 10:38 PM
Yeah that might cause issues actually. And will do.
l

lemon-spoon-91807

11/18/2019, 10:55 PM
Hey Tim! I'm going to look into this. I think it may be the aliases in your provider that were conservatively worrying about. It may be that this scenario should just work and we just need to fix up things on our end
m

millions-judge-24978

11/18/2019, 10:56 PM
Ahh interesting. I think I can remove that alias now that’s transitioned. I’ll give that a try and see if it behaves differnetly
l

lemon-spoon-91807

11/18/2019, 10:58 PM
note: i think you'll likely still get the same issue. but i think in your case it's something we could fix on our end
I'm looking more closely now
m

millions-judge-24978

11/18/2019, 11:06 PM
Things are actually just hanging for me now if I remove it oddly (not what was happening before). In any case seems you’re right that there’s still a problem without the alias.
l

lemon-spoon-91807

11/18/2019, 11:08 PM
Thanks Tim. I know what the issue is, and we're discussing in another channel what can be done. In the meantime, my recommendation is to
await ResourceProvider.register...
first. Very sorry about the inconvenience and any pain this is causing.
m

millions-judge-24978

11/18/2019, 11:10 PM
No worries, just thought I’d give it a shot to provide some more data, thanks!
l

lemon-spoon-91807

11/19/2019, 5:47 PM
Followup, we're using https://github.com/pulumi/pulumi/issues/3528 to track this fully. In the meantime, what we've suggested so far is what you can do to workaround any current issues.
👍 1