Unable to connect to server - 14 UNAVAILABLE: Trying to connect an http1.x server

Moved from GitHub dgraph-js/38

Posted by labs20:

Hi. Runing DGraph 1.0.5, dgraph-js 1.2.1 and grpc 1.12.3.

Working with everything installed until now at my own machine (Mac Air), all good, no problems. Installed a new server on a windows machine to centralize things and when I try to connect to it I got this error:

Error: 14 UNAVAILABLE: Trying to connect an http1.x server

My test function:

async test(){
        const dgraph = require("dgraph-js")
            , grpc = require("grpc")
            , clientStub = new dgraph.DgraphClientStub(
                "192.168.0.253:8080", grpc.credentials.createInsecure()
            )
            , dgraphClient = new dgraph.DgraphClient(clientStub)
        ;

        let res = await dgraphClient.newTxn().query(`
                {
                    query(func: has(__is_pessoas), first: 10){
                      uid
                      app
                      descricao
                    }
                }
            `)
            , ppl = res.getJson()
        ;
    }

If I start ratel locally on my mac and try to connect to that same address with it, it works with no problems.

To clarify: I have a dev node environment on my mac, and I’m trying to connect it to a DGraph server on a windows machine on my network, that should be like a central database for al devs, and the the error ocourrs.

Help, please?

manishrjain commented :

You’re using the wrong port. It should be 9090. Look at ports usage:
https://docs.dgraph.io/deploy/

labs20 commented :

But Ratel is connecting trough that exactly address, and changing it its giving me Connect Failed instead.

Let me double check things here.

P.s: mmmmm… its because ratel is probably connecting trough http protocol, and thus the 8080.

labs20 commented :

Yes, you right. Or almost. =]

The port is wrong, but the right one its actually the 9080. I’ve started the server like this:

dgraph server --lru_mb 4000

and zero like this:

dgraph zero

and the default port is 9080

captura de tela 2018-06-12 as 17 27 35

But, ok. Its working now.

Big thanks!