I'm testing my chaincode in a node client app but I'm not able to submit a transaction. Everything works fine if I invoke/query the chaincode within my peer pods, but if i try to do it in my node client, only the querying works. I have 1 orderer as Solo and 3 peers within K8S minikube. No TLS. I'm using Fabric 1.4.
If I change the connection options to:
discovery: true
asLocalhost: true
I get the following error:
"message": "Endorsement has failed",
"stack": "Error: Endorsement has failed\n at DiscoveryEndorsementHandler._endorse
"message": "14 UNAVAILABLE: failed to connect to all addresses"
If I change the connection options to:
discovery: false
asLocalhost: true
or
discovery: false
asLocalhost: false
I get the following error:
"message": "No orderers assigned to the channel",
"stack": "Error: No orderers assigned to the channel\n at BasicCommitHandler._commit
If I change the connection options to:
discovery: true
asLocalhost: false
I get the following error:
"message": "Endorsement has failed",
"stack": "Error: Endorsement has failed\n at DiscoveryEndorsementHandler._endorse
"message": "14 UNAVAILABLE: DNS resolution failed",
"stack": "Error: 14 UNAVAILABLE: DNS resolution failed
I'll share my connection profile:
---
name: connection.profile
version: 1.0.0
client:
tlsEnable: false
organization: WheyOrg
connection:
timeout:
peer:
endorser: 300
orderer: 300
channels:
wheychannel:
orderes:
- orderer.whey.cluster
peers:
peer1.whey.cluster:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
discover: true
peer1.lab.cluster:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
discover: true
peer1.carrier.cluster:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
discover: true
organizations:
WheyOrg:
mspid: WheyMSP
peers:
- peer1.whey.cluster
certificateAuthorities:
- ca-wheyorg
adminPrivateKey:
path: ./development/network-config/crypto-config/peerOrganizations/whey.cluster/users/Admin@whey.cluster/msp/keystore/priv_sk
signedCert:
path: ./development/network-config/crypto-config/peerOrganizations/whey.cluster/users/Admin@whey.cluster/msp/signcerts/Admin@whey.cluster-cert.pem
orderers:
orderer.whey.cluster:
url: grpc://192.168.64.2:30750
grpcOptions:
ssl-target-name-override: orderer.whey.cluster
grpc-max-send-message-length: 4194304
tlsCACerts:
path: ./development/network-config/crypto-config/ordererOrganizations/whey.cluster/tlsca/tlsca.whey.cluster-cert.pem
peers:
peer1.whey.cluster:
url: grpc://192.168.64.2:30751
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/whey.cluster/tlsca/tlsca.whey.cluster-cert.pem
grpcOptions:
ssl-target-name-override: peer1.whey.cluster
grpc.keepalive_time_ms: 600000
peer1.lab.cluster:
url: grpc://192.168.64.2:30851
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/lab.cluster/tlsca/tlsca.lab.cluster-cert.pem
grpcOptions:
ssl-target-name-override: peer1.lab.cluster
grpc.keepalive_time_ms: 600000
peer1.carrier.cluster:
url: grpc://192.168.64.2:30951
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/carrier.cluster/tlsca/tlsca.carrier.cluster-cert.pem
grpcOptions:
ssl-target-name-override: peer1.carrier.cluster
grpc.keepalive_time_ms: 600000
certificateAuthorities:
ca-wheyorg:
url: http://192.168.64.2:30054
httpOptions:
verify: false
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/whey.cluster/ca/ca.whey.cluster-cert.pem
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: ca-wheyorg
ca-laborg:
url: http://192.168.64.2:30054
httpOptions:
verify: false
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/lab.cluster/ca/ca.lab.cluster-cert.pem
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: ca-laborg
ca-carrierorg:
url: http://192.168.64.2:30054
httpOptions:
verify: false
tlsCACerts:
path: ./development/network-config/crypto-config/peerOrganizations/carrier.cluster/ca/ca.carrier.cluster-cert.pem
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: ca-carrierorg
k8s peer yaml:
# YAML for launching the peer
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: whey-peer
labels:
app: whey-peer
spec:
serviceName: whey-peer
replicas: 1
selector:
matchLabels:
app: whey-peer
template:
metadata:
labels:
app: whey-peer
spec:
containers:
- name: whey-peer
# Image used
image: my_image
# Uncomment the following during development/testing of the image
# imagePullPolicy: Always
env:
- name: FABRIC_CFG_PATH
value: /var/hyperledger/config
- name: FABRIC_LOGGING_SPEC
value: DEBUG
- name: ORDERER_ADDRESS
value: whey-orderer-clusterip:30750
- name: ORG_CONTEXT
value: whey
- name: CORE_PEER_ADDRESS
value: localhost:30751
volumeMounts:
- name: whey-peer-ledger
mountPath: /var/ledger
- name: dockersock
mountPath: /var/run/docker.sock
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
volumeClaimTemplates:
- metadata:
name: whey-peer-ledger
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: general
resources:
requests:
storage: 1Gi
---
# Expose the port 7051 as ClusterIP
apiVersion: v1
kind: Service
metadata:
name: whey-peer-clusterip
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: whey-peer
ports:
- name: whey-peer-clusterip
port: 30751
- name: whey-peer-cc-clusterip
port: 30752
type: ClusterIP
---
# Expose the port 30751 as node port - NEEDED if you
# are interested in connecting to the Pods from the Host
# machine - keep in mind you would need the IP for the node
# port service
apiVersion: v1
kind: Service
metadata:
name: whey-peer-nodeport
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: whey-peer
ports:
- name: whey-peer-nodeport-751
port: 30751
nodePort: 30751
- name: whey-peer-cc-nodeport-752
port: 30752
nodePort: 30752
type: NodePort
I've been trying to figure out what I'm missing here but with no success so far :| What am I missing here?
Let me know if you need more info.
Thank you*