pulumi: "Channel has been shut down" errors in automation.

Expected behavior

Not getting spammed with a bunch of difficult-to-understand errors.

Current behavior

Getting a bunch of errors like:

(node:483560) UnhandledPromiseRejectionWarning: Error: Channel has been shut down
    at ChannelImplementation.createCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/channel.ts:608:13)
    at getCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:319:24)
    at getBottomInterceptingCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:447:16)
    at /home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:541:7
    at Object.getInterceptingCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:543:10)
    at ServiceClientImpl.makeUnaryRequest (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client.ts:299:45)
    at ServiceClientImpl.registerResource (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/make-client.ts:186:15)
    at /home/thayne/sandbox/pulumi-test/node_modules/@pulumi/pulumi/runtime/resource.js:268:106
    at new Promise (<anonymous>)
    at Object.<anonymous> (/home/thayne/sandbox/pulumi-test/node_modules/@pulumi/pulumi/runtime/resource.js:268:65)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
(node:483560) Error: Channel has been shut down
    at ChannelImplementation.createCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/channel.ts:608:13)
    at getCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:319:24)
    at getBottomInterceptingCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:447:16)
    at /home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:541:7
    at Object.getInterceptingCall (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client-interceptors.ts:543:10)
    at ServiceClientImpl.makeUnaryRequest (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/client.ts:299:45)
    at ServiceClientImpl.registerResource (/home/thayne/sandbox/pulumi-test/node_modules/@grpc/grpc-js/src/make-client.ts:186:15)
    at /home/thayne/sandbox/pulumi-test/node_modules/@pulumi/pulumi/runtime/resource.js:268:106
    at new Promise (<anonymous>)
    at Object.<anonymous> (/home/thayne/sandbox/pulumi-test/node_modules/@pulumi/pulumi/runtime/resource.js:268:65)

when running an automation program

Steps to reproduce

  1. Use a program like:
import { LocalWorkspace } from "@pulumi/pulumi/automation";
import * as tls from "@pulumi/tls";

async function program() {
  const privateKey = new tls.PrivateKey("test", {
    algorithm: "ECDSA",
    ecdsaCurve: "P384",
  });

  const ca = new tls.SelfSignedCert("myca", {
    privateKeyPem: privateKey.privateKeyPem,
    keyAlgorithm: privateKey.algorithm,
    allowedUses: ["cert_signing", "crl_signing"],
    validityPeriodHours: 1000 * 3600 * 24,
    subjects: [
      {
        commonName: "test.example.com",
        country: "US",
        locality: "Utah",
        organization: "Example",
      },
    ],
    isCaCertificate: true,
  });
}

async function run() {
  console.info("creating stack");
  const stack = await LocalWorkspace.createOrSelectStack({
    stackName: "dev",
    projectName: "test",
    program: program,
  });

  let command = "preview";
  if (process.argv.length > 2) {
    command = process.argv[2];
  }

  if (command == "preview") {
    console.log("Preview:");
    const result = await stack.preview({
      diff: true,
      onOutput: console.info,
    });
  } else if (command == "up") {
    const result = await stack.up({
      onOutput: console.info,
    });
  } else {
    console.error(`Unknown command ${command}`);
  }
  console.info("done");
}

run().catch((err) => console.error(err));

with a package.json like:

{
    "name": "pulumi-test",
    "main": "index.ts",
    "dependencies": {
        "@pulumi/pulumi": "^3.0.0",
        "@pulumi/tls": "^4.0.0",
        "@types/node": "^10.0.0",
        "ts-node": "^9.1.1"
    },
    "scripts": {
        "start": "./node_modules/ts-node/dist/bin.js index.ts"
    }
}

  1. run npm run start up

Context (Environment)

I just ran into this while experimenting with the automation API. It looks like the rest of the program works as intended but this output makes the output very difficult to read. I also don’t know what the error means, so I’m not sure if there are other negative side effects. I’m using the local backend while experimenting.

Interestingly, if I comment out the SelfSignedCert resource, then I don’t get the error.

Affected feature

automation API

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 36 (28 by maintainers)

Most upvoted comments

it is full of dangling resources, we create namespaces, k8s jobs etc etc, but we do not export them because we do not need them outside of the script. In this specific case we also deploy an empty k8s namespace we do not use (depends on user input if we use it or not). It seems wrong that I need to export everything to bypass this error