fabric
fabric copied to clipboard
Deploying invalid chaincode gives unclear error message in logs and response
I deployed a chaincode with an invalid interface (missing the Init function) and the log message printed
ERR - 21:04:53.383 [rest] ProcessChaincode -> INFO 04c[0m REST processing chaincode request...
ERR - 21:04:53.384 [rest] processChaincodeDeploy -> INFO 04d[0m REST deploying chaincode...
ERR - 21:04:53.384 [rest] processChaincodeDeploy -> INFO 04e[0m Local user 'user_type0_1c2ce7506d' is already logged in. Retrieving login token.
ERR - [31m21:04:54.995 [devops] getChaincodeBytes -> ERRO 04f[0m Error getting chaincode package bytes: Error getting code process done with error = exit status 2
ERR - [31m21:04:54.995 [devops] Deploy -> ERRO 050[0m Error deploying chaincode spec: type:GOLANG chaincodeID: ctorMsg: secureContext:"user_type0_1c2ce7506d"
ERR -
ERR - error: Error getting chaincode package bytes: Error getting code process done with error = exit status 2
ERR - [31m21:04:54.996 [rest] processChaincodeDeploy -> ERRO 051[0m Error when deploying chaincode: Error getting chaincode package bytes: Error getting code process done with error = exit status 2
ERR - 21:04:54.996 [rest] ProcessChaincode -> INFO 052[0m REST sucessfully deploy chaincode: {"jsonrpc":"2.0","error":{"code":-32001,"message":"Deployment failure","data":"Error when deploying chaincode: Error getting chaincode package bytes: Error getting code process done with error = exit status 2"},"id":1}
This made me think it couldn't reach the chaincode in GitHub. Ideally it would have logged a clear message indicating
- That it was an invalid chaincode
- Why it was invalid
- The response to the client contained the unclear error message, but was a 200 instead of a 500
High level notes -
The error "process done with error" stems from "getCodeFromHTTP" in https://github.com/hyperledger/fabric/blob/master/core/chaincode/platforms/golang/hash.go. Investigation would likely be around scraping output (stdout or stderr) from the preceding "go get" exec command and returning it as Error
I can help
@spomytkin go to https://github.com/hyperledger and accept the invite so that @srderson can assign you
@srderson - can this one be closed?