Hyperledger fabric - No response when using sendTransactionProposal() API

232 views Asked by At

This is a tracing network with one channel composed of 3 Orgs, 1 anchor peer per organization, 1 MSP per org, and 1 CA for org3. And I'm not using TLS (because I couldn't find a dependable sample with TLS ON)

I'm trying to use Fabric-sdk-node to build a web front end for it, and I'm using fabcar sample. and when I use invoke.js (almost the same as the example), I find there is no reponse.

Store path:/root/hyperledger-fabric/test/webapp/hfc-key-store
Successfully loaded user1 from persistence
Assigning transaction_id:  8387c087b4b7b9210cdc68ff0ff7fda99c706bad052b9b5138c86df5463244be
Transaction proposal was bad
proposalResponses[0].response is bad
undefined
Failed to send Proposal or receive valid response. Response null or status is not 200. exiting...
Failed to invoke successfully :: Error: Failed to send Proposal or receive valid response. Response null or status is not 200. exiting...

and the code is

if (proposalResponses && proposalResponses[0].response && proposalResponses[0].response.status === 200) {
    isProposalGood = true;
    console.log('Transaction proposal was good');
} else {
    console.error('Transaction proposal was bad');
    if (!proposalResponses) {
    console.log('proposalResponses is bad');
    }
    if (!proposalResponses[0].response) {
    console.log('proposalResponses[0].response is bad');
    //console.log(proposalResponses[0].response.status);
    }   
}

When I check the the docker logs(in ca, peer0, orderer ), I find the only thing changed in orderer.trace.com

2021-05-04 07:41:41.136 UTC [comm.grpc.server] 1 -> INFO 007 streaming call completed {"grpc.start_time": "2021-05-04T07:40:41.77Z", "grpc.service": "orderer.AtomicBroadcast", "grpc.method": "Deliver", "grpc.peer_address": "172.21.0.8:39422", "error": "context finished before block retrieved: context canceled", "grpc.code": "Unknown", "grpc.call_duration": "59.36575566s"}

After several attempts, this error occurred on one occasion in peer0.sell.trace.com

2021-05-04 01:44:31.199 UTC [ConnProducer] NewConnection -> ERRO 034 Failed connecting to orderer.trace.com:7050 , error: context deadline exceeded
2021-05-04 01:44:31.200 UTC [deliveryClient] connect -> ERRO 035 Failed obtaining connection: Could not connect to any of the endpoints: [orderer.trace.com:7050]
2021-05-04 01:44:31.200 UTC [deliveryClient] try -> WARN 036 Got error: Could not connect to any of the endpoints: [orderer.trace.com:7050] , at 1 attempt. Retrying in 1s

I'm a very newbie in both fabric and nodejs, so any kind of help would be great. Thanks in advance.


NEW EDIT

My peer yaml

peer0.sell.trace.com:
  container_name: peer0.sell.trace.com
  image: hyperledger/fabric-peer:latest
  environment:
    - CORE_PEER_ID=peer0.sell.trace.com
    - CORE_PEER_ADDRESS=peer0.sell.trace.com:7051
    - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.sell.trace.com:7051
    - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.sell.trace.com:7051
    - CORE_PEER_LOCALMSPID=OrgSellMSP
    - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=test_default
    - FABRIC_LOGGING_SPEC=INFO
    #- FABRIC_LOGGING_SPEC=DEBUG
    - CORE_PEER_GOSSIP_USELEADERELECTION=true
    - CORE_PEER_GOSSIP_ORGLEADER=false
    - CORE_PEER_PROFILE_ENABLED=true
    ##TLS
    #- CORE_PEER_TLS_ENABLED=true
    #- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
    #- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
    #- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
    - GODEBUG=netdns=go
  working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
  command: peer node start
  volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/sell.trace.com/peers/peer0.sell.trace.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/sell.trace.com/peers/peer0.sell.trace.com/tls:/etc/hyperledger/fabric/tls
      #- ./crypto-config/peerOrganizations/sell.trace.com/users/[email protected]/tls:/etc/hyperledger/client/tls
  ports:
    - 1151:7051
    - 1153:7053
  networks:
    default:
      aliases:
        - test

my connection.json

{
    "name": "first-network-org_sell",
    "version": "1.0.0",
    "client": {
        "organization": "org_sell",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "3000"
                }
            }
        }
    },
    "organizations": {
        "org_sell": {
            "mspid": "OrgSellMSP",
            "peers": [
                "peer0.sell.trace.com",
                "peer1.sell.trace.com"
            ]
        }
    },
    "peers": {
        "peer0.sell.trace.com": {
            "url": "grpc://localhost:7051",
        },
        "peer1.sell.trace.com": {
            "url": "grpc://localhost:7051",
        }
    }
}
0

There are 0 answers