Hi, I am getting `warning: Synchronous call made t...
# general
m
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
Perhaps - the latest versions of that library should avoid this. What version of
@pulumi/awsx
are you using?
m
1.9.0 Woops that was aws not awsx
@pulumi/awsx@0.18.13
w
Could you share the snippet where you construct
new awsx.ec2.Vpc
? Do you pass a
provider:
?
m
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
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
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
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
Yeah that might cause issues actually. And will do.
l
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
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
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
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
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
No worries, just thought I’d give it a shot to provide some more data, thanks!
l
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