I am new to hyperledger fabric. I have downloaded the fabric v1.2.0 and I tried to run fabcar example from the fabric-sample folder. My querying on the chaincode went well, but when I tried to invoke the chaincode I got the below error from the cmd.
This is my request to the chaincode
var request = {
//targets: let default to the peer assigned to the client
chaincodeId: 'fabcar',
fcn: 'changeCarOwner',
args: ['CAR4', 'Dave'],
chainId: 'mychannel',
txId: tx_id
};
Error:
Failed to invoke successfully :: TypeError: fabric_client.newEventHub is not a function
When I tried to find newEventHub in index.t.ds, I could not find the function. Can anyone help me with this.Thanks in advance.
I think they've replaced the EventHub class with ChannelEventHub.
You can update the invoke.js file with following:
on line 105:
let event_hub = channel.newChannelEventHub('localhost:7051');
// event_hub.setPeerAddr('grpc://localhost:7053');
on line 130:
console.log('The transaction has been committed on peer ' + event_hub.getPeerAddr());
That should fix it.
Change the fabric-client npm version from "unstable" to ^1.2.1 in package.json and run npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With