19

My grpc server is in go (go-micro), and it working fine, I have tested both via micro web and go web app (iris).

This is a local grpc setup

I keep getting this error (Stream removed)

{ Error: 2 UNKNOWN: Stream removed
    at new createStatusError ([projectROOT]/node_modules/grpc/src/client.js:64:15)
    at [projectROOT]/node_modules/grpc/src/client.js:583:15
  code: 2,
  metadata: Metadata { _internal_repr: {} },
  details: 'Stream removed' }

and sometimes I get this error (Trying to connect an http1.x server)

{ Error: 14 UNAVAILABLE: Trying to connect an http1.x server
    at new createStatusError ([projectROOT]/node_modules/grpc/src/client.js:64:15)
    at [projectROOT]/node_modules/grpc/src/client.js:583:15
  code: 14,
  metadata: Metadata { _internal_repr: {} },
  details: 'Trying to connect an http1.x server' }

My Node Code

const grpc = require('grpc');

const AuthPB      = require('./auth_pb');
const AuthService = require('./auth_grpc_pb');

const AuthClient = new AuthService.AuthClient(
    `localhost:59685`,
    grpc.credentials.createInsecure()
);

function run(cb) {
  const AuthTokenRequest = new AuthPB.AuthTokenRequest({
    token: `some token`,
  });
  AuthClient.isLoggedIn(AuthTokenRequest, (err, authRes) => {
    if(!err) return cb({status: 1});
    cb({
      status: 0,
      err,
      message: 'Not loggedin',
    });
  });
}


run(console.log);

Facing the same problem with Python code also

Errors
Traceback (most recent call last):
  File "app.py", line 15, in <module>
    run()
  File "app.py", line 11, in run
    res = AuthStub.IsLoggedIn(atReq)
  File "[python3.6-path]/site-packages/grpc/_channel.py", line 484, in __call__
    return _end_unary_response_blocking(state, call, False, deadline)
  File "[python3.6-path]/site-packages/grpc/_channel.py", line 434, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, Trying to connect an http1.x server)>

.

Traceback (most recent call last):
  File "app.py", line 15, in <module>
    run()
  File "app.py", line 11, in run
    res = AuthStub.IsLoggedIn(atReq)
  File "[python3.6-path]/site-packages/grpc/_channel.py", line 484, in __call__
    return _end_unary_response_blocking(state, call, False, deadline)
  File "[python3.6-path]/site-packages/grpc/_channel.py", line 434, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNKNOWN, Stream removed)>

My Python Code

import grpc
import auth_pb2
import auth_pb2_grpc

def run():
    channel = grpc.insecure_channel('localhost:59685')
    AuthStub = auth_pb2_grpc.AuthStub(channel)
    atReq = auth_pb2.AuthTokenRequest(token='some token')
    res = AuthStub.IsLoggedIn(atReq)
    print("IsLoggedin: " + res.status)

if __name__ == "__main__":
    run()
p u
  • 1,395
  • 1
  • 17
  • 30
HamidRaza
  • 640
  • 1
  • 7
  • 15
  • 3
    You may be encountering the same problem as in https://stackoverflow.com/questions/49308482/is-there-a-way-to-configure-the-generate-method-name-for-grpc-node-client: the URL paths that go-micro's code generator generates are not compatible with the standard paths that gRPC uses. – murgatroid99 Mar 26 '18 at 17:40
  • 1
    I encountered the same issue using grpc node lib based clients, that is, both grpcc and official client examples in grpc repo. – James Jun 03 '18 at 14:51
  • 1
    I am not sure why this happens, but I know that GRPC forces HTTP/1 for insecure connections, and maybe your client does not like HTTP/1. Try using TLS which uses HTTP/2 – jmhostalet Feb 18 '20 at 11:00

1 Answers1

5

I had same error message when client tried create insecure connection but server use ssl

Try to replace

grpc.credentials.createInsecure()

on

grpc.credentials.createSsl()
Alexey Muravyov
  • 1,106
  • 13
  • 17