Did something change recently on tracking open pro...
# automation-api
p
Did something change recently on tracking open promises? The following code works standalone, but fails on 50 or more open promises using the automation api.
Copy code
import * as k8s from '@pulumi/kubernetes';
import * as pulumi from '@pulumi/pulumi';

// get the cluster stack from infra-launchpad-cluster package
const clusterStack = new pulumi.StackReference(`settlemint/bpaas-clusters/production`);

// fetch the correct kubeconfig file
const kubeconfig = clusterStack.requireOutput(`${'GKE'}${'EUROPE'}kubeconfig`.toLowerCase());

// create a k8s provider to talk to the cluster for this service based on provider and region
const provider = new k8s.Provider(`kdkdkdkdkdkd`, {
  kubeconfig,
});

console.log(provider);
It is normal that there are a lot of open promises since it is embedded in my application. In the automation api the error reported is
an unhandled error occurred: The Pulumi runtime detected that 58 promises were still active
the logs show me
Copy code
[2021-01-20T15:33:14.006Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     pulumi:pulumi:Stack bpaas-development-network-seven-6007f12d919014eb1faca353 running read pulumi:pulumi:StackReference settlemint/bpaas-clusters/production
[2021-01-20T15:33:21.775Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     pulumi:pulumi:Stack bpaas-development-network-seven-6007f12d919014eb1faca353 running read pulumi:pulumi:StackReference settlemint/bpaas-clusters/production
[2021-01-20T15:33:22.489Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     pulumi:pulumi:Stack bpaas-development-network-seven-6007f12d919014eb1faca353 running error: an unhandled error occurred: The Pulumi runtime detected that 33 promises were still active
[2021-01-20T15:33:22.491Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     pulumi:pulumi:Stack bpaas-development-network-seven-6007f12d919014eb1faca353 **failed** 1 error
[2021-01-20T15:33:22.492Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService] Diagnostics:
[2021-01-20T15:33:22.492Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]   pulumi:pulumi:Stack (bpaas-development-network-seven-6007f12d919014eb1faca353):
[2021-01-20T15:33:22.492Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     error: an unhandled error occurred: The Pulumi runtime detected that 33 promises were still active
[2021-01-20T15:33:22.492Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     at the time that the process exited. There are a few ways that this can occur:
[2021-01-20T15:33:22.492Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]       * Not using `await` or `.then` on a Promise returned from a Pulumi API
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]       * Introducing a cyclic dependency between two Pulumi Resources
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]       * A bug in the Pulumi Runtime
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     Leaving promises active is probably not what you want. If you are unsure about
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     environment variable. The Pulumi runtime will then print out additional
[2021-01-20T15:33:22.493Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     debug information about the leaked promises.
[2021-01-20T15:33:22.495Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService] Resources:
[2021-01-20T15:33:22.495Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService]     1 unchanged
[2021-01-20T15:33:22.495Z] [DEBUG] [eris] [development] 64763 settlemint/development-network-seven-6007f12d919014eb1faca353 [PulumiService] Duration: 10s
l
Open promises are not normal. I don't believe anything has changed in this area recently.
The following code works standalone, but fails on 50 or more open promises using the automation api
What do you mean it fails on 50 or more open promises? Where are 50 open promises coming from? This program doesn't leak promises when run via the CLI, but does via automation api?
p
Yes, in the standalone version as posted above, no errors, exit code 0
The same code in automation api, and i’ve seen 33, 5something open promises
when i use the promises debug env var i see this: https://gist.github.com/roderik/b02c97d0e904f9eee48f0b6a603cf4d4
fetch a kubeconfig (gke in this case) from the stack and throw it into a provider preparing for the rest but that code is completely commented out
I had a bunch of working programs before i upgraded to the latest .2 version
hmm downgrading to .1 did not help
maybe i upgraded from .0 to .2, trying downgrading to .0 now
ah, maybe it is .1 thast worked but i need to re-up the original stack
it started marking kubeconfigs as secrets at some point (makes sense thoigh)
ok, nothing to do with the version. Difference with my previous programs is that i use a stack reference now.
ok, adding the following make the snippet program work:
const readableKubeconfig = unsecret(kubeconfig);
This feels like either a bug or a doc issue
l
@proud-pizza-80589 would you mind capturing these details in an issue: https://github.com/pulumi/pulumi/issues/new?assignees=&labels=needs-triage&template=bug_report.md&title= I would not expect secretness of an output to cause pulumi string interpolation to fail.
p