hyperledger / fabric-samples

Samples for Hyperledger Fabric
https://wiki.hyperledger.org/display/fabric
Apache License 2.0
2.78k stars 3.37k forks source link

Error while invoking Init function in chaincode: Cannot use metadata. Metadata did not match schema #567

Open Dimple-Kanwar opened 2 years ago

Dimple-Kanwar commented 2 years ago

Hi, I am trying to deploy a chaincode in my fabric network with init function invoke. My chaincode is getting committed on peers but I am getting an error message while invoking init function.

Note: I am running my custom chaincode on test-network sample setup.

Please find the following attached screenshot to see the proper error message.

Screen Capture_select-area_20211220231205

Let me know the cause of this error.

denyeart commented 2 years ago

@mbwhite any ideas?

Dimple-Kanwar commented 2 years ago

@denyeart This error was caused by Peer package included in chaincode. I just removed Peer package and changed returnType of chaincode functions from Peer.Response to (Asset, error). Is there any new change introduced in Peer chaincode package which requires some parameters to be passed? I remember it used to work completely fine when I was working on fabric 1.4 version.

mbwhite commented 2 years ago

@Dimple-Kanwar are you able to share your code please that caused the issue.

Are you using the fabric-contract-go ? or fabric-shim-go?