fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Deploying invalid chaincode gives unclear error message in logs and response

Open srderson opened this issue 9 years ago • 4 comments
trafficstars

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

  1. That it was an invalid chaincode
  2. Why it was invalid
  3. The response to the client contained the unclear error message, but was a 200 instead of a 500

srderson avatar Apr 27 '16 21:04 srderson

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

muralisrini avatar Apr 27 '16 21:04 muralisrini

I can help

spomytkin avatar May 06 '16 19:05 spomytkin

@spomytkin go to https://github.com/hyperledger and accept the invite so that @srderson can assign you

christo4ferris avatar May 06 '16 19:05 christo4ferris

@srderson - can this one be closed?

mastersingh24 avatar Jun 18 '16 09:06 mastersingh24