0

我正在使用 Vagrant 在本地网络设置上运行我的区块链应用程序。
网络( ca 和 vp )在 Vagrant VM 内运行,而我的应用程序位于 Vagrant 之外。当我在禁用安全性的情况下运行我的应用程序时,一切正常。但是现在当我尝试启用安全性时,我收到以下错误:

himanshus-mbp:BCApplication himanshutyagi$ node app.js 
loading hardcoded peers
loading hardcoded users
[ibc-js] Peer:  vp0-dev_vp0...:5000
[ibc-js] No membership users found after filtering, assuming this is a network w/o membership
[ibc-js] Found chaincode in local file system
[ibc-js] Scanning files [ '.DS_Store', 'chaincode_finished.go', 'finished' ]
[ibc-js] Parsing file for shim version
[ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim
[ibc-js] Parsing file for invoke functions - chaincode_finished.go
[ibc-js] Found cc invoke function:  init
[ibc-js] Found cc invoke function:  delete_product
[ibc-js] Found cc invoke function:  delete_offering
[ibc-js] Found cc invoke function:  delete_contract
[ibc-js] Found cc invoke function:  delete_client
[ibc-js] Found cc invoke function:  write
[ibc-js] Found cc invoke function:  init_product
[ibc-js] Found cc invoke function:  init_offering
[ibc-js] Found cc invoke function:  init_contract
[ibc-js] Found cc invoke function:  init_client
[ibc-js] Found cc invoke function:  set_user_type
[ibc-js] Parsing file for query functions - chaincode_finished.go
[ibc-js] Found cc query function:  read
[ibc-js] Found cc query function:  read_product_index
[ibc-js] Found cc query function:  read_offering_index
[ibc-js] Found cc query function:  read_contract_index
[ibc-js] Found cc query function:  read_client_index
[ibc-js] load_chaincode() finished
chaincode summary file indicates chaincode has been previously deployed
------------------------------------------ Chain is up and running ------------------------------------------
Getting Offering List: 
[ibc-js] read  - success: { jsonrpc: '2.0',
  error: 
   { code: -32602,
     message: 'Invalid params',
     data: 'Must supply username for chaincode when security is enabled.' },
  id: 1469460324754 }
read _offeringindex: null { name: 'query() resp error',
  code: 400,
  details: 
   { code: -32602,
     message: 'Invalid params',
     data: 'Must supply username for chaincode when security is enabled.' } }
/Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106
        if (!arr.length) {
                ^

TypeError: Cannot read property 'length' of null
    at Object.async.each (/Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106:17)
    at /Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/app.js:379:10
    at Object.options.success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/index.js:1020:22)
    at success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:109:30)
    at IncomingMessage.<anonymous> (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:192:7)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

奇怪的是,在日志中,它说No membership users found after filtering我还重新部署了链代码,与enrollID and enrollPW我在区块app.js链 js 配置中提到的相同。以下是详细信息:

var options =   {
                    network:{
                        /*
                        peers: peers,
                        users: users,
                        options: {quiet: true, tls:false, maxRetry: 1}*/
                        'peers': [
                            {
                                        'discovery_host': 'localhost',
                                        'discovery_port': 30303,
                                        'api_host': 'localhost',
                                        'api_port_tls': 443,
                                        'api_port': 5000,
                                        'type': 'peer',
                                        'network_id': 'dev',
                                        'id': 'dev_vp0',
                                        'api_url': 'http://localhost:5000'
                                    }
                            ],
                            "users": [
                          {
                            "username": "tyagi_user_type1",
                            "secret": "1ccf8703ac",
                            "enrollId": "tyagi_type1",
                            "enrollSecret": "1ccf8703ac"
                          }
                        ],
                    options: {quiet: true, tls:false, maxRetry: 1}
                    },
                    ...
};

“必须为链码提供用户名”是什么意思。在本地网络上启用安全性运行时,是否有人遇到过类似的问题?
更新: 所以,我将 enrillId 更改为user_type1_xxx,现在“未找到会员用户..”消息不再出现。但是当用户尝试注册时,我收到连接被拒绝错误。

himanshus-mbp:BCApplication himanshutyagi$ node app.js
loading hardcoded peers
loading hardcoded users
[ibc-js] Peer:  vp0-dev_vp0...:443
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x1 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x2 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x3 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x4 : user_type1_tyagi 500
! looks like an error loading the chaincode or network, app will fail
 { name: 'register() error',
  code: 500,
  details: 
   { [Error: connect ECONNREFUSED 127.0.0.1:443]
     code: 'ECONNREFUSED',
     errno: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 443 } }
4

0 回答 0