fabric-samples icon indicating copy to clipboard operation
fabric-samples copied to clipboard

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

Open Dimple-Kanwar opened this issue 4 years ago • 3 comments

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.

Dimple-Kanwar avatar Dec 20 '21 17:12 Dimple-Kanwar

@mbwhite any ideas?

denyeart avatar Jan 04 '22 05:01 denyeart

@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.

Dimple-Kanwar avatar Jan 05 '22 13:01 Dimple-Kanwar

@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?

mbwhite avatar Jan 05 '22 15:01 mbwhite