简体   繁体   中英

How to fix “Error: 14 UNAVAILABLE: TCP Write failed” with hyperledger Fabric blockchain application

I am actually working with this Hyperledger Fabric blockchain application on my computer ( https://github.com/rastringer/medication-blockchain ) and I can run the application on port 8000.

But I have a problem: when I want to create drug record or change drug holder with the application on port 8000, I have this message in my terminal:

"... Transaction proposal was good Successfully sent Proposal and received ProposalResponse: Status - 200, message - "" Failed to invoke successfully :: Error: There was a problem with the eventhub ::Error: 14 UNAVAILABLE: TCP Write failed"

And sometimes I have the same message but with

..."TCP Read failed"

More, the green message with the success of the transaction and the transaction ID is not writing like the example in the picture, and this for the both (create drug record & change drug holder).

But when I refresh the page on the port 8000, the new transaction appears in the table, even if there is the message error.

And I checked the application in another computer, and there is not this problem (I have the last version of Linux Ubuntu 18.04.2)

Thank you in advance for any help :)

ur answer is correct, code sample was similar to fabric-samples/fabcar chaincode. In fabcar, developer didn't implement any web api, that's way he used the invoke.js. But in drug-app case, developer implemented the web application, where u don't need the invoke.js. But due to the cope of the chaincode from fabcar, he forgot to remove the invoke part!

func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {

function, args := APIstub.GetFunctionAndParameters()
if function == "queryDrug" {
    return s.queryDrug(APIstub, args)
} else if function == "initLedger" {
    return s.initLedger(APIstub)
} else if function == "recordDrug" {
    return s.recordDrug(APIstub, args)
} else if function == "queryAllDrug" {
    return s.queryAllDrug(APIstub)
} else if function == "changeDrugHolder" {
    return s.changeDrugHolder(APIstub, args)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM