Failed to invoke successfully :: TypeError: fabric_client.newEventHub is not a function


Received this error when running ‘node invoke.js’


Open invoke.js in your text editor.

comment lines 105 and 106
//let event_hub = fabric_client.newEventHub();

add this line instead.

	let event_hub = channel.newChannelEventHub('localhost:7051');

Then comment line 131
//console.log('The transaction has been committed on peer ’ + event_hub._ep._endpoint.addr);

and add the below line instead.

console.log('The transaction has been committed on peer ' + event_hub.getPeerAddr());

Now save the file and execute. It should work now.