Hi Guys, any idea this code fails? ```async funct...
# typescript
c
Hi Guys, any idea this code fails?
Copy code
async function waitForServiceAccount(accountNum: string): Promise<any> {
  if (!pulumi.runtime.isDryRun()) {
      // Wait for up to 10 minutes
      for (let i = 0; i < 60; i++) {
          const objectViewer = await gcp.serviceAccount.getAccount({
            accountId: `service-${accountNum}`
          });
          if (objectViewer.email && objectViewer.name && objectViewer.uniqueId) {
              return objectViewer.email;
          }
          <http://pulumi.log.info|pulumi.log.info>(`Waiting for Service Account ${accountNum} (${i})`)
          // Wait for 10s between polls
          await new Promise(r => setTimeout(r, 10000));
      }
      throw new Error("timed out waiting for Job to complete");
  }
}

const email= serviceProject.number.apply(projectNumber => waitForServiceAccount(projectNumber));
serviceProject
is of course created before but in the same ts file. Getting this error:
Copy code
error: Request "Create IAM Members roles/compute.securityAdmin serviceAccount:Calling [toString] on an [Output<T>] is not supported.\n\nTo get the value of an Output<T> as an Output<string> consider either:\n1: o.apply(v => `prefix${v}suffix`)\n2: pulumi.interpolate `prefix${v}suffix`\n\nSee <https://pulumi.io/help/outputs> for more details.\nThis function may throw in a future version of @pulumi/pulumi. for \"project \\\"xxxxxxxx\\\"\"" returned error: Error applying IAM policy for project "xxxxxxxx": Error setting IAM policy for project "xxxxxxxxxx": googleapi: Error 400: Invalid service account (calling [tostring] on an [output<t>] is not supported.
    
    to get the value of an output<t> as an output<string> consider either:
    1: o.apply(v => `prefix${v}suffix`)
    2: pulumi.interpolate `prefix${v}suffix`
f
I think the plobem might be with the usage of the outputs, e.g. objectViewer.email. If the return type is Output it should be used like objectViewer.email.apply(v => v) to get the string value.