hyperledger-bevel / bevel-operator-fabric

Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.3, v2.4 and v2.5, soon 3.0)
https://hyperledger-bevel.github.io/bevel-operator-fabric/
Apache License 2.0
278 stars 93 forks source link

Unable to connect to fabric network through gateway using SDK(api) where wallet details are stored externally in MongoDB #147

Closed piyushaNeo closed 1 year ago

piyushaNeo commented 1 year ago

What happened?

I have deployed fabric network using Bevel Operator Fabric(previously HLF operator) on local Kubernetes KinD cluster. We deployed external chaincode & able to invoke/query through CLI. Next when we try to communicate with fabric network through node js application, it fails to connect with the network. In invoke.js, It works fine till registering & enrolling admin user but next when it tries to connect with fabric using gateway, it fails there. Is this because we have integrated MongoDB with our client application & customized it to store wallet details in MongoDB.

What did you expect to happen?

To connect SDK(api) with fabric network (deployed using Bevel operator Fabric) through gateway from the wallet details that are stored in our external MongoDB. I am not getting why is it not able to fetch the wallet details of admin/user when trying to connect with fabric network through gateway.

How can we reproduce it (as minimally and precisely as possible)?

Communicating from the client application with the fabric network using the wallet details of admin/user stored in external MongoDB

Anything else we need to know?

We have been storing our wallet details externally in MongoDB. So each time a user tries to communicate with fabric network. The wallet details are fetched from MongoDB and then processed. Getting this error: [Error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: org1-peer1.fabric, url:grpcs://172.18.0.2:30168, connected:false, connectAttempted:true](info: [NetworkConfig]: buildPeer - Unable to connect to the endorser org1-peer1.fabric due to TypeError: Channel options must be an object with string or number value)

Kubernetes version

Kubernetes version: 1.24.0

dviejokfs commented 1 year ago

Try using Istio, not sure if you can access this IP:PORT 172.18.0.2:30168 from the machine you are executing the SDK.

piyushaNeo commented 1 year ago

When I do transactions through Filesystem wallet it works properly but instead of that I created a wallet in external DB (mongo) and tried to submit the transaction, then it fails & not able to connect!

piyushaNeo commented 1 year ago

Hi team, I set up the network using ISTIO (in kind cluster)still facing the same issue. Error: 2023-02-24T11:08:57.251Z - error: [ServiceEndpoint]: ServiceEndpoint grpcs://peer1-org1.localho.st:443 reset connection failed :: TypeError: Channel options must be an object with string or number values 2023-02-24T11:08:57.251Z - error: [DiscoveryService]: send[demo] - no discovery results error : Error: DiscoveryService has failed to return results

@dviejokfs Can you please help me out here

piyushaNeo commented 1 year ago

It was an issue related to npm module fabirc-network in package.json. Upgrading it to the latest version 2.2.16 fixed it. Now able to communicate through SDK(API) with the deployed fabric network.