etcd3 icon indicating copy to clipboard operation
etcd3 copied to clipboard

GRPCUnavailableError:UNAVAILABLE: No connection established

Open AhmedZahRan7 opened this issue 3 years ago • 1 comments

It's just happened when trying running the quick-start in the redmi file

const { Etcd3 } = require('etcd3');
const client = new Etcd3();

(async () => {
    await client.put('foo').value('bar');

    const fooValue = await client.get('foo').string();
    console.log('foo was:', fooValue);

    const allFValues = await client.getAll().prefix('f').keys();
    console.log('all our keys starting with "f":', allFValues);

    await client.delete().all();
})();

The output error is:

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^
GRPCUnavailableError: 14 UNAVAILABLE: No connection established

Node version is 17.6.0

AhmedZahRan7 avatar May 18 '22 20:05 AhmedZahRan7

Check if your etcd is using a certfile

Example in docker-compose.yml

      - /usr/local/bin/etcd
      - --data-dir=/data
      - --name=etcdv3
      - --advertise-client-urls=https://etcdv3:2379
      - --listen-client-urls=https://0.0.0.0:2379
      - --cert-file=/etc/etcd/etcdv3.mycert.com.br.crt
      - --key-file=/etc/etcd/etcdv3.mycert.com.br.key

In this case, you need to add the certified to your client

Dockerfile

ENV NODE_EXTRA_CA_CERTS=$project_home/public.crt

Remember to check if you set up everything right inside your container

  • echo $NODE_EXTRA_CA_CERTS
  • cat $project_home/public.crt

icetbr avatar Nov 20 '22 02:11 icetbr