[英]Hyperledger fabric application-javascript error using client server model in app.js
https://github.com/hyperledger/fabric-samples In the file app.js in director asset-transfer-basic->application-javascript when I insert the code of server to listen on a port and try to call the contract it gives out the error as follows. https://github.com/hyperledger/fabric-samples当我插入服务器代码以侦听端口并尝试调用合约时,在director assets-transfer-basic->application-javascript 的文件app.js 中给出如下错误。 enter image description here在此处输入图像描述
connection.write(data.toString());
console.log('Sent response to client');
connection.end();
console.log('Disconnected the client.');
});
});
server.listen(port, function () {
console.log('server is listening');
});
console.log('\n--> Evaluate Transaction: GetSignedRank, function returns signed rank');
var result = await contract.evaluateTransaction('GetSignedRank', '123');
console.log(result.toString());
//console.log(`*** Result: ${prettyJSONString(result.toString())}`);
} finally {
// Disconnect from the gateway when the application is closing
// This will close all connections to the network
gateway.disconnect();
}
} catch (error) {
console.error(`******** FAILED to run the application: ${error}`);
}
} }
the problem is in this line var result = await contract.evaluateTransaction('GetSignedRank', '123');问题出在这一行 var result = await contract.evaluateTransaction('GetSignedRank', '123');
I solved it by making a separate nodejs file and calling a duplicate of file app.js which allowed to call the evaluateTransaction method.I think the error was the connection was ended in the server code before I called the evaluateTransaction我通过制作一个单独的nodejs文件并调用允许调用evaluateTransaction方法的文件app.js的副本来解决它。我认为错误是在我调用evaluateTransaction之前连接已在服务器代码中结束
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.