I'm running my blockchain application on local network setup using Vagrant.
The network (ca and vp ) are running inside Vagrant VM while my application resides outside Vagrant. When I ran my application with security disabled, everything works fine. But now when I tried with security enabled, I'm getting the following error:
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)
What also is weird is that in the logs, it says No membership users found after filtering
I also re deployed the chaincode with the same enrollID and enrollPW
as I've mentioned in my app.js
blockchain js configuration. Following are the details:
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}
},
...
};
What does "Must supply username for chaincode" mean. Has anyone faced a similar issue while running with security enabled on a local network ?
UPDATE:
So, I changed the enrillId to user_type1_xxx
, now "No Membership users found.." message doesn't come anymore. But I'm getting a connection refused error when the user is trying to register.
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 } }