Getting deployment error when deploying sample script in Developer composer playground - hyperledger-composer

I'm trying to setup the development environment for composer by following the steps in the tutorial. I was able to generate the .bna file successfully and use it in the online playground. But when I try to deploy the .bna file to the fabric V1.0 running in my local, I get the below error.
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network$ cd dist
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network/dist$ composer network
deploy -a my-network.bna -p hlfv1 -i PeerAdmin -s randomString
Deploying business network from archive: my-network.bna
Business network definition:
Identifier: my-network#0.0.1
Description: The Hello World of Hyperledger Composer samples
events.js:160
throw er; // Unhandled 'error' event
^
Error: event message must be properly signed by an identity from the same organization as the peer: [failed deserializing event creator: [Expected MSP ID Org1MSP, received ]]
at ClientDuplexStream._emitStatusIfDone (/home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._receiveStatus (/home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:169:8)
at /home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:634:14
My docker images are as follows:
ubuntu#ip-172-31-8-83:~/fabric-tools/my-network/dist$ docker ps -a
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS
NAMES
80c9949edf73 hyperledger/fabric-peer:x86_64-1.0.0-beta "peer
node start -..." 19 minutes ago Up 19 minutes 0.0.0.0:7051-
>7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
126f6381cc90 hyperledger/fabric-couchdb:x86_64-1.0.0-beta "tini --
/docker-e..." 19 minutes ago Up 19 minutes 4369/tcp, 9100/tcp,
0.0.0.0:5984->5984/tcp couchdb
924081546fa1 hyperledger/fabric-ca:x86_64-1.0.0-beta "sh -c
'fabric-ca-..." 19 minutes ago Up 19 minutes 0.0.0.0:7054-
>7054/tcp ca.example.com
d13f2c8e8421 hyperledger/fabric-orderer:x86_64-1.0.0-beta "orderer"
19 minutes ago Up 19 minutes 0.0.0.0:7050->7050/tcp
orderer.example.com
Node version is: 4.2.6
npm version is : 3.5.2
Docker version 17.06.0-ce, build 02c1d87
Can someone tell me how to resolve this?

you need to be at the latest Node level - you're currently at 4.2.6 - you need to be at node version 6.x
https://hyperledger.github.io/composer/unstable/installing/development-tools.html
I assume you're using Ubuntu 14.04 or 16.0x LTS ..

Related

Error starting hyperledger-composer network after Fabric and Composer version upgrade

I've come across an error starting the hyperledger-composer network that isn't answered in the composer-wiki.
✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: transaction returned with failure: can't find PEM header: undefined
Command failed
Checking pre-requisites,
Fabric 1.2
Composer 0.20.4
Node 8.12.0
Docker 18.01.1
"composer network install" was successful, with file appearing in the docker peer at /var/hyperleder/production/chaincodes
After running the "composer network start" command, a "docker ps" shows new docker instance with name:
dev-peer0.org1.example.com-<<business-network-name>>-0.0.7
But any attempt to ping this results in a failure like this:
Error: Error trying to ping. Error: make sure the chaincode <<business-network-name>> has been successfully instantiated and try again: getccdata composerchannel/<<business-network-name>> responded with error: could not find chaincode with name '<<business-network-name>>'
Checking the log of the dev-peer0, it ends with the following:
2018-11-05T05:03:18.227Z [4264161f] ERROR :Composer :Init() can't find PEM header: undefined
2018-11-05T05:03:18.227Z [4264161f] VERBOSE :Composer :#PERF Init() Total (ms) duration for txnID [4264161fc30a61c70884d4c7efb460fea6a755d07bc4852875c393346795227a]: 929.00
2018-11-05T05:03:18.228Z ERROR [lib/handler.js] [composerchannel-4264161f]Calling chaincode Init() returned error response [can't find PEM header: undefined]. Sending ERROR message back to peer
The corresponding error in the peer0 log is a big larger:
2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> ERRO 439d [composerchannel][4264161f] failed to invoke chaincode name:"lscc" , error: transaction returned with failure: can't find PEM header: undefined
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:131
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2361
2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> DEBU 439e [composerchannel][4264161f] Exit
Since this last worked I have updated composer from 0.19 to 0.20.4, and taken Fabric from 1.1 to 1.2.
Googling suggests that this kind of error "can't find PEM header: undefined" is associated with a change in key signing. After tearing down Fabric I re-ran ./createPeerAdminCard.sh - is there another card or similar that needs to be re-created to accomodate the latest versions?
Thanks to #R Thatcher for putting me onto the right direction. This was all down to mismatching cards, and was resolved by clearing out everything and starting again.
Specifically, in /fabric-dev-servers:
./stopFabric.sh
./teardownFabric.sh
composer card list
composer card delete -c admin#<business-network-name>
composer card delete -c PeerAdmin#hlfv1
./startFabric.sh
./createPeerAdminCard.sh
Then changing into the composer/business-network-name directory:
composer network install --card PeerAdmin#hlfv1 --archiveFile business-network-name\#0.0.7.bna
composer network start -c PeerAdmin#hlfv1 -n business-network-name -V 0.0.7 -A admin -S adminpw --file networkadmin.card
composer card import --file networkadmin.card --card admin#business-network-name
composer network ping -c admin#business-network-name
So yes, it was about mismatching cards and not cleaning these up as part of a new deployment.
Although not part of the original problem, it's also worth noting that the -A and -S parameters of the composer network start command HAD to be set to admin and adminpw respectively. See composer issue #3781.
Answering the the last remark from #Capn Sparrow
"the -A and -S parameters of the composer network start command HAD to be set to admin and adminpw respectively."
This is the correct and expected behaviour :-)
with the composer network start command the -A and -S are specifying an existing user in the CA that we want a new set of Credentials (certificate and keys) for which is then bound to a Composer System participant.
When you use the 'standard development fabric' this has a CA configured with a user called 'admin' with a secret of 'adminpw'. If you had build your own Fabric from scratch you could choose the name and secret of your first default user. Alternatively you could work with the fabric-ca client software to create additional users in the CA.

Error running query from hyperledger composer Queries tutorial against couchdb Fabric runtime

I am trying to connect the dots between Composer and Fabric to build a proof of concept application that supports multiple orgs. So, I am using the Composer tutorials to build the business network and then the "Deploying to a multi-organization business network" tutorial (which references the Fabric "Build your first network" tutorial, but tells you to use a different git repo than the BYFN tutorial, which I did).
I was able to use the Developer tutorial from Composer to build the simple trade business network, and then copy the archive to the folder where I built out the multi-org business network with Fabric (which requires couchdb, which I'd want to use anyway in order to be able to do more complex querying), start it all up and then use the explorer REST API to create participants, assets, and trade transactions. This all worked fine.
Then, I moved onto the Composer Queries tutorial to add the queries.qry, generate a new archive, copied & updated the fabric install of the archive, stopped & updated & restarted the REST API server. I can see the queries in the REST API now so I know it has picked up the new code. However, regardless of which of the queries I try to run through the REST API explorer, they all return the same error:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying to query business network. Error: chaincode error (status: 500, message: Error: Couch DB Error:invalid_operator, Status Code:400, Reason:Invalid operator: $class)",
"stack": "Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: Couch DB Error:invalid_operator, Status Code:400, Reason:Invalid operator: $class)\n at channel.queryByChaincode.then.catch (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:809:34)\n at <anonymous>"
}
}
The simplest of the queries from the tutorial is a simple get all with no arguments, so the problem can't be what I'm passing in (as there is literally nothing to pass in). The problem has to be something systemic.
Example: the get all commodities query
query selectCommodities {
description: "Select all commodities"
statement:
SELECT org.acme.biznet.Commodity
}
The error message says it doesn't like $class in the response.
The response from the GET all commodities endpoint (which doesn't use the query) is:
[
{
"$class": "org.acme.biznet.Commodity",
"tradingSymbol": "KPX",
"description": "KnitPicks",
"mainExchange": "SP",
"quantity": 50,
"owner": "resource:org.acme.biznet.Trader#4567"
},
{
"$class": "org.acme.biznet.Commodity",
"tradingSymbol": "KPX2",
"description": "KnitPicks",
"mainExchange": "SP",
"quantity": 120,
"owner": "resource:org.acme.biznet.Trader#4567"
}
]
and the API doc for the selectCommodities query sample response is of the same format:
[
{
"$class": "org.acme.biznet.Commodity",
"tradingSymbol": "string",
"description": "string",
"mainExchange": "string",
"quantity": 0,
"owner": {}
}
]
so I am not sure what is wrong, but it seems like it would have to be either a problem with the query itself not being compatible with CouchDB, or a problem in the translation layer from the query in Composer to the low level Fabric API? The latter theory is supported by the 500 being returned by the Composer API layer having a nested 400 error, implying that something that the Composer layer through hlfconnection is passing is invalid.
Any help is greatly appreciated! I can't imagine I'm the first to run across this but I haven't found anything online that's directly related.
Thanks in advance!
Composer version 0.16.6
Docker PS:
f844a2957bd5 dev-peer0.org2.example.com-tutorial-network-0.16.6-95a0f8a4fe6ff659a5943abc80b26a1134e77b74942eef102fa92c8480b680eb "chaincode -peer.add…" 24 hours ago Up 24 hours dev-peer0.org2.example.com-tutorial-network-0.16.6
556c9f3841ce dev-peer0.org1.example.com-tutorial-network-0.16.6-e4f751b9b8b3a307f6bf25ea97ccf3625bd75730a1dcb3f989a9a34bbb73f536 "chaincode -peer.add…" 24 hours ago Up 24 hours dev-peer0.org1.example.com-tutorial-network-0.16.6
831ca5b9a839 dev-peer1.org2.example.com-tutorial-network-0.16.6-a184efa69bdcbcb2e6ec3764e01d56f0c574ca0ad09d4656269d3b7aefbc44b8 "chaincode -peer.add…" 24 hours ago Up 24 hours dev-peer1.org2.example.com-tutorial-network-0.16.6
6faf5b875df9 dev-peer1.org1.example.com-tutorial-network-0.16.6-44b9f2a6ea1ed75f106aa0b5fc8387c95cbde9eee551df9fb36d16709f2db981 "chaincode -peer.add…" 24 hours ago Up 24 hours dev-peer1.org1.example.com-tutorial-network-0.16.6
afbcbe9292fd dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab "chaincode -peer.add…" 26 hours ago Up 26 hours dev-peer1.org2.example.com-mycc-1.0
8444f922486d dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9 "chaincode -peer.add…" 26 hours ago Up 26 hours dev-peer0.org1.example.com-mycc-1.0
753588bacb47 dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b "chaincode -peer.add…" 26 hours ago Up 26 hours dev-peer0.org2.example.com-mycc-1.0
662b61c00673 hyperledger/fabric-peer "peer node start" 26 hours ago Up 26 hours 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
80a37822a0d6 hyperledger/fabric-peer "peer node start" 26 hours ago Up 26 hours 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
2878eacafb29 hyperledger/fabric-peer "peer node start" 26 hours ago Up 26 hours 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
e8f3259dca2a hyperledger/fabric-peer "peer node start" 26 hours ago Up 26 hours 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
a79c29e762cd hyperledger/fabric-couchdb "tini -- /docker-ent…" 26 hours ago Up 26 hours 4369/tcp, 9100/tcp, 0.0.0.0:6984->5984/tcp couchdb1
34271122957a hyperledger/fabric-couchdb "tini -- /docker-ent…" 26 hours ago Up 26 hours 4369/tcp, 9100/tcp, 0.0.0.0:8984->5984/tcp couchdb3
8b88227ea7a7 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 26 hours ago Up 26 hours 0.0.0.0:7054->7054/tcp ca_peerOrg1
a75fa6328b02 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 26 hours ago Up 26 hours 0.0.0.0:8054->7054/tcp ca_peerOrg2
4e21c3c8fa16 hyperledger/fabric-orderer "orderer" 26 hours ago Up 26 hours 0.0.0.0:7050->7050/tcp orderer.example.com
2881999a4c7b hyperledger/fabric-couchdb "tini -- /docker-ent…" 26 hours ago Up 26 hours 4369/tcp, 9100/tcp, 0.0.0.0:7984->5984/tcp couchdb2
8a77a5e86a3a hyperledger/fabric-couchdb "tini -- /docker-ent…" 26 hours ago Up 26 hours 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb0
This is probably due to a match of Composer version (16.x) to versions of Fabric (1.1). Composer 0.16.x ONLY works with Fabric v1.0.x (you can check from your logs / docker images what you installed). The release notes detail which versions of composer will work with which versions of fabric. eg
https://github.com/hyperledger/composer/releases
Composer v0.18.2 and above is compatible with Fabric 1.1 GA only
Composer v0.18.0 -> v0.18.1 : compatible with the Fabric 1.1 RC1 driver only
Composer v0.17.3 -> v0.17.6 (old) are compatible with Fabric 1.1 alpha driver only
Composer v0.16.x -> compatible with Fabric v1.0.x only

Hyperledge Composer publish definitions failed

This is not a duplicates, at least I have the right version of Composer, I have also read the 3 stackflow composer questions.
I tried to publish definition, the Basic-Sample-Network package came from the git respository, the Basic-sample-network.bna archive file, here's the command :
composer network deploy -p hlfv1.json -a basic-sample-network.bna -i admin -s adminpw
The error (seems to be a generic error message):
Identifier: basic-sample-network#0.1.3
Description: The Hello World of Hyperledger Composer samples
events.js:160
throw er; // Unhandled 'error' event
^
Error: event message must be properly signed by an identity from the same organization as the peer: [failed deserializing event creator: [Expected MSP ID Org1MSP, received ]]
at ClientDuplexStream._emitStatusIfDone (/usr/local/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._receiveStatus (/usr/local/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:169:8)
at /usr/local/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:634:14
Here're my environments :
composer -v :
composer-cli v0.10.0
composer-admin v0.10.0
composer-client v0.10.0
composer-common v0.10.0
composer-runtime-hlf v0.10.0
composer-runtime-hlfv1 v0.10.0
npm c 3.10.10
hlfv1.json profile :
{
"type": "hlfv1",
"orderers": [
{ "url" : "grpc://localhost:7050" }
],
"ca": { "url": "http://localhost:7054",
"name": "ca.org1.example.com"
},
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
}
],
"keyValStore": "${HOME}/.composer-credentials",
"channel": "composerchannel",
"mspID": "Org1MSP",
"timeout": "300"
}
Note I used the fabric-tool script the start the fabric and to generate the profile (hlfv1.json).
docker ps:
570ae25a586e hyperledger/fabric-peer:x86_64-1.0.0 "peer node start -..." 30 minutes ago Up 30 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
513431e5d217 hyperledger/fabric-ca:x86_64-1.0.0 "sh -c 'fabric-ca-..." 31 minutes ago Up 31 minutes 0.0.0.0:7054->7054/tcp ca.org1.example.com
2e7bf444481d hyperledger/fabric-couchdb:x86_64-1.0.0 "tini -- /docker-e..." 31 minutes ago Up 31 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
5d5ba67cc602 hyperledger/fabric-orderer:x86_64-1.0.0 "orderer" 31 minutes ago Up 30 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
If you follow the developer tutorial you will see that the id PeerAdmin must be used to deploy the network.
https://hyperledger.github.io/composer/tutorials/developer-guide.html
Problem fixed.
The confusion was providing the connectionProfileName, the -p option, based on reading the document, I thought I have to provide a file with connection information (even thought the provided profile information contain all necessary information), I didn't know it was actually picking up the profile file from ~/.composer-connection-profiles folder based on the name provided in the -p option.

Logstash install error: can't get unique system GID (no more available GIDs)

I am trying to install logstash with yum on a red hat vm, I already have the logstash.repo file setup according to the guide and i ran
yum install logstash
but I get the following error after it downloads everything
...
logstash-2.3.2-1.noarch.rpm | 72 MB 00:52
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
groupadd: Can't get unique system GID (no more available GIDs)
useradd: group 'logstash' does not exist
error: %pre(logstash-1:2.3.2-1.noarch) scriptlet failed, exit status 6
Error in PREIN scriptlet in rpm package 1:logstash-2.3.2-1.noarch
error: install: %pre scriptlet failed (2), skipping logstash-1:2.3.2-1
Verifying : 1:logstash-2.3.2-1.noarch 1/1
Failed:
logstash.noarch 1:2.3.2-1
Complete!
I can't find much information about this. Any suggestions?
groupadd determines gids for the creation of regular groups from the /etc/login.defs file.
In my centos 6 box. /etc/login.defs contains following two lines:
#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN 500
GID_MAX 60000
For system accounts add these two lines to your /etc/login.defs
# System accounts
SYS_GID_MIN 100
SYS_GID_MAX 499
I updated the SYS_GID_MAX Value and it worked for me.

VirtualBox And Genymotion launch from command line issue

I have installed latests Genymotion version 2.4.0 and Virtual Box 4.3.26 r98988.
When i run genymotion from Jenkins or command line on MacOSX Yosemite:
/Applications/Genymotion.app/Contents/MacOS/player --vm-name "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920"
i have this issues:
Logging activities to file: .Genymobile/genymotion.log
Logging activities to file: .Genymobile/Genymotion/deployed/Google Nexus 5 - 4.4.4 - API 19 - 1080x1920/genymotion-player.log
OpenGL connected to 192.168.56.101:25000
Port 22468 will be used for OpenGL data connections
Unknown TCPCLI command 1003
Jenkins waits indefinitely and the calabash tests are not running.
Logs of genymotion have no particular errors, but virtualbox's log (VBoxSVC.log) have this error:
00:00:00.130196 nspr-2 HostDnsMonitorProxy::notify
00:00:00.130211 nspr-2 HostDnsMonitorProxy: Host's DNS information updated:
00:00:00.130214 nspr-2 server 1: 10.10.0.30
00:00:00.130217 nspr-2 server 2: 10.10.0.31
00:00:00.130221 nspr-2 no search string entries
00:00:00.130223 nspr-2 no domain set
00:00:00.134010 nspr-2 failed to create vboxnet0, error (0x80004005)
00:00:00.134189 nspr-2 VDInit finished
You may want to try "--quiet" while running the player.
I have the same error "Unknown TCPCLI command 1003" but it still seems to work fine.
This is how I run mine.
File: run.sh
vboxmanage snapshot "Google Nexus S - 2.3.7 - API 10 - 480x800" restore "factory"
/Applications/Genymotion.app/Contents/MacOS/player --quiet --vm-name "Google Nexus S - 2.3.7 - API 10 - 480x800" &
echo "going to sleep"
sleep 30
echo "wake up"

Resources