0
votes

I am trying to send request to hyperledger fabric blockchain network through my NodeJS test client and I always receive the following:

error: [Remote.js]: Error: Failed to connect before the deadline
[hl] Query has completed, checking results
[hl] Query error:  Error: Failed to connect before the deadline
    at checkState (/opt/hl/test/frontend/node_modules/fabric-client/node_modules/grpc/src/client.js:838:16)

I am trying to find out what is wrong, there is nothing suspicious in peer logs. I am using the following version:

  • HL v1.2.0
  • NodeJS v8.11.4
  • grpc v1.14.1

EDIT:

The code that is failing:

var channel = fabric_client.newChannel('mychannel');
var peer = fabric_client.newPeer('grpc://localhost:7051');
channel.addPeer(peer);
var order = fabric_client.newOrderer('grpc://localhost:7050')
channel.addOrderer(order);

channel.queryByChaincode(request) <-- ERROR

The hyperledger is running because I am able to query and invoke chaincode functions through Java SDK.

2
please add the code sample as well. - Pandit
That error message means that the gRPC client is failing to establish a connection to the server. Maybe you used the wrong server name or port number, or maybe the server is down for some reason. - murgatroid99
See my edit. Server is running on that port because I am able to use it through Java SDK. - user1563721
Hi same issue here. I've this issue in Ubuntu 16.04 when connecting through NodeJS SDK. The issue doesn't occur when submitting transaction through peer command in cli container. It doesn't occur in OSX either when connecting through NodeJS SDK. Any workaround? - ning

2 Answers

0
votes

It seems to be a permission issue. When I start the client side with sudo, assigning it root previlige. The issue is resolved. Still not sure about the root cause.

sudo env "PATH=$PATH" ./fabric.sh start
0
votes

Try setting a longer timeout and then re-running it export GRPC_WAIT_FOR_READY_TIMEOUT=6000