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
280 stars 93 forks source link

Not able to approve chaincode #167

Open puneetmathur-87 opened 1 year ago

puneetmathur-87 commented 1 year ago

I am trying a simple demo setup using the steps provided but I am stuck at the chaincode approve step and it shows the below error:

kubectl hlf chaincode approveformyorg --config=org1.yaml --user=admin --peer=org1-peer0.hyperledger    --package-id=$PACKAGE_ID --name=asset --channel=demo
Error: failed to get discovery service: could not get chConfig cache reference: QueryBlockConfig failed: QueryBlockConfig failed: queryChaincode failed: Multiple errors occurred: - Transaction processing for endorser [peer1-org1.localho.st:443]: Chaincode status Code: (500) UNKNOWN. Description: channel 'demo' not found - Transaction processing for endorser [peer0-org1.localho.st:443]: Chaincode status Code: (500) UNKNOWN. Description: channel 'demo' not found

But the channel and the chaincode both exists :

kubectl get fabricmainchannel -A
NAME   STATE   AGE
demo           27h
kubectl get fabricchaincodes -A 
NAMESPACE     NAME    STATE   AGE
default       asset           23h
hyperledger   asset           25h

One strange thing I noticed in the peer pod logs that the grpc stream calls always cancelled whereas the unary calls are always successful:

2023-05-31 17:11:26.124 UTC 0020 INFO [gossip.comm] GossipStream -> Peer 7820ccd89778b0a09cfe6546ffd5fc6949bad9f53d0f745ca177ac7094d449e3 (127.0.0.1:35946) probed us
2023-05-31 17:11:26.125 UTC 0021 INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.request_deadline=2023-05-31T17:11:36.124Z grpc.peer_address=127.0.0.1:35946 grpc.peer_subject="CN=peer,OU=peer" grpc.code=OK grpc.call_duration=843.525µs
2023-05-31 17:11:26.127 UTC 0022 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2023-05-31T17:11:28.127Z grpc.peer_address=127.0.0.1:35960 grpc.peer_subject="CN=peer,OU=peer" grpc.code=OK grpc.call_duration=52.861µs
2023-05-31 17:11:26.128 UTC 0023 INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.peer_address=127.0.0.1:35960 grpc.peer_subject="CN=peer,OU=peer" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=1.06331ms
2023-05-31 17:11:56.130 UTC 0024 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2023-05-31T17:11:58.129Z grpc.peer_address=127.0.0.1:59284 grpc.peer_subject="CN=peer,OU=peer" grpc.code=OK grpc.call_duration=80.821µs
2023-05-31 17:11:56.132 UTC 0025 INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.peer_address=127.0.0.1:59284 grpc.peer_subject="CN=peer,OU=peer" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=1.668438ms
2023-05-31 17:11:56.139 UTC 0026 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=gossip.Gossip grpc.method=Ping grpc.request_deadline=2023-05-31T17:11:58.139Z grpc.peer_address=10.244.1.3:55994 grpc.peer_subject="CN=peer,OU=peer" grpc.code=OK grpc.call_duration=52.413µs
2023-05-31 17:11:56.141 UTC 0027 INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=gossip.Gossip grpc.method=GossipStream grpc.peer_address=10.244.1.3:55994 grpc.peer_subject="CN=peer,OU=peer" error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=1.145974ms
puneetmathur-87 commented 1 year ago

Can someone help on this issue?

pshgpt commented 1 year ago

export SEQUENCE=1 export VERSION="1.0" kubectl hlf chaincode approveformyorg --config=org1.yaml --user=admin --peer=org1-peer0.default \ --package-id=$PACKAGE_ID \ --version "$VERSION" --sequence "$SEQUENCE" --name=asset \ --policy="OR('Org1MSP.member')" --channel=demo

This is the correct command for approving the chaincode. Please check if you are using the correct one or not
sergimima commented 6 months ago

Having the exact same usse, did you manage to fix it?