0

I am running a HLF samples k8 network locally (kind/ network up).

enter image description here

Now in the nodejs app on the host machine

   const gateway = new Gateway();
    
            const gatewayOpts: GatewayOptions = {
                wallet,
                identity: this.org1UserId,
                discovery: { enabled: true, asLocalhost: true }, // using asLocalhost as this gateway is using a fabric network deployed locally
            };
    
            try {
                // setup the gateway instance
                // The user will now be able to create connections to the fabric network and be able to
                // submit transactions and query. All transactions submitted by this gateway will be
                // signed by this user using the credentials stored in the wallet.
                console.log('Trying to connect now ...');
                await gateway.connect(ccp, gatewayOpts);
                console.log('Connection established');
                // Build a network instance based on the channel where the smart contract is deployed
                const network = await gateway.getNetwork(this.channelName);
                console.log('network', network);

Connection error

Loaded the network configuration located at /Users/tdhillon/Workspace/block-chain/lynx/hlf-k8-network/build/fabric-rest-sample-config/HLF_CONNECTION_PROFILE_ORG1
Built a CA Client named org1-ecert-ca
Built a file system wallet at /Users/tdhillon/Workspace/block-chain/lynx/hlf-server-app/wallet
Trying to connect now ...
2022-03-06T11:00:30.567Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: org1-peer1, url:grpcs://org1-peer1:7051, connected:false, connectAttempted:true
2022-03-06T11:00:30.568Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server org1-peer1 url:grpcs://org1-peer1:7051 timeout:3000
2022-03-06T11:00:30.592Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser org1-peer1 due to Error: Failed to connect before the deadline on Endorser- name: org1-peer1, url:grpcs://org1-peer1:7051, connected:false, connectAttempted:true
    at checkState (/Users/tdhillon/Workspace/block-chain/lynx/hlf-server-app/node_modules/@grpc/grpc-js/src/client.ts:172:18)
    at Timeout._onTimeout (/Users/tdhillon/Workspace/block-chain/lynx/hlf-server-app/node_modules/@grpc/grpc-js/src/channel.ts:707:9)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  connectFailed: true
}

I think the issue is because the hostmachine isn't able to connect to the pods in the test-network.

  1. Is there was a way for the hostmachine to access the services through the dns names e.g. 'org1-peer1'
  2. Are there any other ways of establishing a development environment ??

Any suggestions are much appreciated.

Thanks

maxkart
  • 619
  • 5
  • 21
  • What's the Kubernetes version you're using? – Bazhikov Mar 07 '22 at 13:44
  • Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:10:45Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"darwin/amd64"} – maxkart Mar 07 '22 at 18:19
  • does your issue still persist? – Bazhikov Apr 04 '22 at 13:40
  • You can check [this answer](https://stackoverflow.com/questions/66172170) related to a similar issue. – Andrew Skorkin Apr 06 '22 at 14:59
  • This link outlines an easy way of standing up the environment https://github.com/hyperledger/fabric-samples/tree/main/test-network-k8s – maxkart Apr 06 '22 at 16:06

0 Answers0