最运行node sdk时,出现了以下错误:
[root@slave3 node-sdk]# node test.js
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [CoreOrg1MSP]
at new createStatusError (/opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15)
at /opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:583:15
error: [Channel.js]: Failed Query channel info. Error: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [CoreOrg1MSP]
at new createStatusError (/opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15)
at /opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:583:15
(node:12726) UnhandledPromiseRejectionWarning: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [CoreOrg1MSP]
at new createStatusError (/opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15)
at /opt/gopath/src/github.com/hyperledger/fabric/scf/node-sdk/node_modules/fabric-client/node_modules/grpc/src/client.js:583:15
(node:12726) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:12726) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
导致这个错误的原因有很多。比如用户没有权限,通道配置文件填写错误等等。我这里是因为使用的是普通user用户的身份信息来操作fabric系统,但是普通的user用户没有权限(具体什么权限不太清楚)。所以将keystore和signcerts改成Admin的即可解决。