IBM-Blockchain-Archive / fabric-boilerplate

Get up and running quickly with your own blockchain application!
Apache License 2.0
79 stars 150 forks source link

Unable to login!! Query method throws error! #22

Closed gokulamurthy closed 7 years ago

gokulamurthy commented 7 years ago

Please find below log, while i login with the users defined in testdata file.

debug: Login attempt w/ username: john1 error: [SDK] error on query: { error: { status: 'FAILURE', msg: { '0': 69, '1': 114, '2': 114, '3': 111, '4': 114, '5': 58, '6': 70, '7': 97, '8': 105, '9': 108, '10': 101, '11': 100, '12': 32, '13': 116, '14': 111, '15': 32, '16': 108, '17': 97, '18': 117, '19': 110, '20': 99, '21': 104, '22': 32, '23': 99, '24': 104, '25': 97, '26': 105, '27': 110, '28': 99, '29': 111, '30': 100, '31': 101, '32': 32, '33': 115, '34': 112, '35': 101, '36': 99, '37': 40, '38': 67, '39': 111, '40': 117, '41': 108, '42': 100, '43': 32, '44': 110, '45': 111, '46': 116, '47': 32, '48': 103, '49': 101, '50': 116, '51': 32, '52': 100, '53': 101, '54': 112, '55': 108, '56': 111, '57': 121, '58': 109, '59': 101, '60': 110, '61': 116, '62': 32, '63': 116, '64': 114, '65': 97, '66': 110, '67': 115, '68': 97, '69': 99, '70': 116, '71': 105, '72': 111, '73': 110, '74': 32, '75': 102, '76': 111, '77': 114, '78': 32, '79': 54, '80': 102, '81': 100, '82': 50, '83': 52, '84': 52, '85': 54, '86': 57, '87': 51, '88': 99, '89': 54, '90': 97, '91': 54, '92': 55, '93': 50, '94': 51, '95': 56, '96': 53, '97': 57, '98': 98, '99': 100, '100': 50, '101': 54, '102': 101, '103': 97, '104': 57, '105': 55, '106': 50, '107': 48, '108': 100, '109': 100, '110': 99, '111': 53, '112': 51, '113': 51, '114': 55, '115': 97, '116': 99, '117': 101, '118': 102, '119': 53, '120': 102, '121': 99, '122': 55, '123': 53, '124': 48, '125': 55, '126': 51, '127': 52, '128': 100, '129': 97, '130': 97, '131': 49, '132': 100, '133': 100, '134': 100, '135': 102, '136': 101, '137': 55, '138': 54, '139': 53, '140': 97, '141': 101, '142': 53, '143': 32, '144': 45, '145': 32, '146': 76, '147': 101, '148': 100, '149': 103, '150': 101, '151': 114, '152': 69, '153': 114, '154': 114, '155': 111, '156': 114, '157': 32, '158': 45, '159': 32, '160': 82, '161': 101, '162': 115, '163': 111, '164': 117, '165': 114, '166': 99, '167': 101, '168': 78, '169': 111, '170': 116, '171': 70, '172': 111, '173': 117, '174': 110, '175': 100, '176': 58, '177': 32, '178': 108, '179': 101, '180': 100, '181': 103, '182': 101, '183': 114, '184': 58, '185': 32, '186': 114, '187': 101, '188': 115, '189': 111, '190': 117, '191': 114, '192': 99, '193': 101, '194': 32, '195': 110, '196': 111, '197': 116, '198': 32, '199': 102, '200': 111, '201': 117, '202': 110, '203': 100, '204': 41 } }, msg: 'Error:Failed to launch chaincode spec(Could not get deployment transaction for 6fd244693c6a6723859bd26ea9720ddc5337acef5fc750734daa1dddfe765ae5 - LedgerError - ResourceNotFound: ledger: resource not found)' }

Please help me to fix this.

czar0 commented 7 years ago

Something went wrong deploying the chaincode. Please have a look at the Troubleshooting paragraph in the README.

gokulamurthy commented 7 years ago

Thanks for the reply, i followed the steps mentioned in Troubleshooting paragraph in the README file but doesn't help to resolve it. I have noticed these logs in the console:

vp0_1 | 2016/12/26 12:59:21 transport: http2Server.HandleStreams failed to receive the preface from client: EOF vp0_1 | 2016/12/26 13:00:21 grpc: Server.Serve failed to create ServerTransport: connection error: desc = "transport: write tcp 172.17.0.3:7051->172.17.0.1:48896: write: broken pipe"

One more changes which i have in my local environment is docker images are latest instead of x86_64-0.2.1 tag version:

REPOSITORY TAG IMAGE ID CREATED SIZE hyperledger/fabric-baseimage x86_64-0.2.1 930520b2a511 7 weeks ago 1.345 GB hyperledger/fabric-membersrvc latest b3654d32e4f9 9 weeks ago 1.417 GB hyperledger/fabric-peer latest 21cb00fb27f4 9 weeks ago 1.424 GB

This might help you find the root cause. Looking forward for your help.

czar0 commented 7 years ago

Let's go through step by step.

  1. Is govend installed correctly? What is the log running npm run installgo? Do you have the vendor directory under src/build-chaincode ?
  2. Can you build your chaincode locally with npm run gobuild? (that means empty log)
  3. What is the log in your peer during the deploying phase? (look for deploy keyword there)
  4. Are you running a correct version of the fabric-baseimage? Does it have latest tag? (have a look in the README in Prerequisites)
gokulamurthy commented 7 years ago

Let's go through step by step.

Is govend installed correctly? What is the log running npm run installgo? /opt/Workspace/fabric-boilerplate$ npm run installgo

server@0.0.0 installgo /opt/Workspace/fabric-boilerplate cd src/build-chaincode && GOPATH=$(pwd)/../.. && govend -v

github.com/hyperledger/fabric/core/chaincode/shim google.golang.org/grpc google.golang.org/grpc/transport google.golang.org/grpc/peer google.golang.org/grpc/credentials golang.org/x/net/context google.golang.org/grpc/metadata google.golang.org/grpc/grpclog google.golang.org/grpc/codes golang.org/x/net/trace golang.org/x/net/internal/timeseries golang.org/x/net/http2/hpack golang.org/x/net/http2 golang.org/x/net/lex/httplex golang.org/x/net/idna google.golang.org/grpc/test/codec_perf github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/proto/testdata github.com/golang/protobuf/proto/proto3_proto google.golang.org/grpc/naming google.golang.org/grpc/internal google.golang.org/grpc/credentials/oauth golang.org/x/oauth2/jwt golang.org/x/oauth2/jws golang.org/x/oauth2/internal golang.org/x/oauth2 google.golang.org/appengine/urlfetch google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/internal google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/log google.golang.org/appengine/internal/datastore google.golang.org/appengine/internal/base golang.org/x/oauth2/google google.golang.org/appengine google.golang.org/appengine/internal/modules google.golang.org/appengine/internal/app_identity cloud.google.com/go/compute/metadata golang.org/x/net/context/ctxhttp cloud.google.com/go/internal github.com/spf13/viper gopkg.in/yaml.v2 gopkg.in/check.v1 github.com/stretchr/testify/assert github.com/pmezard/go-difflib/difflib github.com/davecgh/go-spew/spew github.com/davecgh/go-spew/spew/testdata github.com/spf13/pflag github.com/spf13/jwalterweatherman github.com/spf13/cast github.com/spf13/afero golang.org/x/text/unicode/norm golang.org/x/text/transform golang.org/x/text/internal/testtext golang.org/x/text/internal/gen golang.org/x/text/unicode/cldr golang.org/x/text/internal/ucd golang.org/x/text/internal/triegen github.com/spf13/afero/sftp github.com/pkg/sftp golang.org/x/crypto/ssh golang.org/x/crypto/ssh/testdata golang.org/x/crypto/ssh/terminal golang.org/x/crypto/ed25519 golang.org/x/crypto/ed25519/internal/edwards25519 golang.org/x/crypto/curve25519 github.com/pkg/errors github.com/kr/fs github.com/spf13/afero/mem github.com/pelletier/go-toml github.com/pelletier/go-buffruneio github.com/mitchellh/mapstructure github.com/magiconair/properties github.com/magiconair/properties/_third_party/gopkg.in/check.v1 github.com/magiconair/properties/_third_party/gopkg.in/check.v1 bad ping: stat vendor/github.com/magiconair/properties/_third_party/gopkg.in/check.v1: no such file or directory github.com/hashicorp/hcl github.com/hashicorp/hcl/testhelper github.com/hashicorp/hcl/json/parser github.com/hashicorp/hcl/json/token github.com/hashicorp/hcl/hcl/token github.com/hashicorp/hcl/hcl/strconv github.com/hashicorp/hcl/json/scanner github.com/hashicorp/hcl/hcl/ast github.com/hashicorp/hcl/hcl/parser github.com/hashicorp/hcl/hcl/scanner github.com/fsnotify/fsnotify golang.org/x/sys/unix github.com/op/go-logging github.com/looplab/fsm github.com/hyperledger/fabric/protos github.com/hyperledger/fabric/core/util golang.org/x/crypto/sha3 github.com/golang/protobuf/ptypes/timestamp github.com/golang/protobuf/ptypes/empty github.com/hyperledger/fabric/core/comm github.com/hyperledger/fabric/core/config github.com/hyperledger/fabric/core/chaincode/shim/crypto/ecdsa github.com/hyperledger/fabric/core/crypto/primitives github.com/hyperledger/fabric/core/crypto/utils github.com/hyperledger/fabric/core/chaincode/shim/crypto github.com/hyperledger/fabric/core/chaincode/shim/crypto/attr github.com/hyperledger/fabric/core/crypto/attributes github.com/hyperledger/fabric/core/crypto/attributes/proto

Do you have the vendor directory under src/build-chaincode ? YES

/opt/Workspace/fabric-boilerplate/src/build-chaincode/vendor$ ls cloud.google.com github.com golang.org google.golang.org gopkg.in

Can you build your chaincode locally with npm run gobuild? (that means empty log) YES

/opt/Workspace/fabric-boilerplate/src/build-chaincode$ ls -l total 15624 -rwxrwxr-x 1 hyperledger_admin hyperledger_admin 15968592 Dec 26 18:26 build-chaincode -rw-r--r-- 1 hyperledger_admin hyperledger 1434 Dec 20 12:47 chaincode.go drwxr-xr-x 2 hyperledger_admin hyperledger 4096 Dec 20 12:47 data drwxr-xr-x 2 hyperledger_admin hyperledger 4096 Dec 20 12:47 invoke drwxr-xr-x 2 hyperledger_admin hyperledger 4096 Dec 26 15:14 query drwxr-xr-x 2 hyperledger_admin hyperledger 4096 Dec 20 12:47 utils drwxrwxr-x 7 hyperledger_admin hyperledger_admin 4096 Dec 26 18:24 vendor -rw-r--r-- 1 hyperledger_admin hyperledger 2503 Dec 20 12:47 vendor.yml

What is the log in your peer during the deploying phase? (look for deploy keyword there)

Blockchain directory: /opt/Workspace/fabric-boilerplate/blockchain

Do you want to clear the environment? [y/N] y keyValStore removed Latest deployed removed All docker containers removed All chaincode images removed All untagged images removed Starting docker containers... Docker containers up and running

server@0.0.0 start /opt/Workspace/fabric-boilerplate npm run build-css | npm run watch-css | npm run nodemon

server@0.0.0 nodemon /opt/Workspace/fabric-boilerplate GOPATH=$(pwd) nodemon ./bin/www

[nodemon] 1.11.0 [nodemon] to restart at any time, enter rs [nodemon] watching: . [nodemon] starting node ./bin/www Rendering Complete, saving .css file... Wrote CSS to /opt/Workspace/fabric-boilerplate/client/assets/css/main.css Using credentials from file. info: [SDK] Initializing the blockchain info: [SDK] $GOPATH: /opt/Workspace/fabric-boilerplate info: [SDK] Running in local mode debug: [SDK] CA: grpc://localhost:7054 debug: [SDK] Peer: grpc://localhost:7051 info: [SDK] Connected to memberservice and peer info: [NodeJS] Express server listening at http://localhost:8080 info: [SDK] Successfully registered WebAppAdmin info: [SDK] Going to register users debug: [SDK] Checking if redeploy is needed debug: Found chaincode id from file: debug: [SDK] Going to deploy chaincode info: [SDK] User john1 successfully registered and enrolled info: [SDK] User jane1 successfully registered and enrolled debug: [SDK] Successfully deployed chaincode debug: [SDK] Deploy result: { uuid: '3690eef3bb6ebe563b17388c5e58c451efb097ba122f26146c506acae32b3f53', chaincodeID: '3690eef3bb6ebe563b17388c5e58c451efb097ba122f26146c506acae32b3f53', result: undefined } debug: Saving chaincode id 3690eef3bb6ebe563b17388c5e58c451efb097ba122f26146c506acae32b3f53 info: [SDK] Watching /opt/Workspace/fabric-boilerplate/src/build-chaincode for changes... info: [SDK] Done. info: [SDK] Calling callback... info: -- Deploying Test Data as WebAppAdmin -- debug: [SDK] WebAppAdmin submitted invoke function add_test_data [{"id":"john1","firstName":"John","lastName":"Doe","things":["12345678","87654321"],"salt":"2e227983e2460e56f8220f68d59e12d8","hash":"254b43f0633ca20211400678eeeb34e8e892b8f39847cdbc2f4bdd72aaa09cef3c29d5f50d484b502c627d06165624f7f2b701b5837558bc98cb57151454bdf9","address":"Dam 1, 1012 JS Amsterdam, The Netherlands","phoneNumber":"0900 0048","emailAddress":"johndoe@gmail.com","role":0},{"id":"jane1","firstName":"Jane","lastName":"Doe","things":["87654321"],"salt":"16b3ac0fc233d88bb1ed63f39876c5e9","hash":"870161cde7f3087ef602bfca6c42062d20b3e5c4f73c5c72a6dcbf78559097233092fe58f299ea47ca36aedd404b6b910e47031db56e31b8c978b531d8f9225a","address":"128 West 44th Street, New York, NY 10036, United States","phoneNumber":"0900 0024","emailAddress":"janedoe@gmail.com","role":1}] debug: -- Added testData

Are you running a correct version of the fabric-baseimage? Does it have latest tag? (have a look in the README in Prerequisites)

I have correct tag for fabric-baseimage docker image, but not for the fabric-membersrvc and fabric-peer. Those are the latest. Please find below result:

REPOSITORY TAG IMAGE ID CREATED SIZE hyperledger/fabric-baseimage x86_64-0.2.1 930520b2a511 7 weeks ago 1.345 GB hyperledger/fabric-membersrvc latest b3654d32e4f9 9 weeks ago 1.417 GB hyperledger/fabric-peer latest 21cb00fb27f4 9 weeks ago 1.424 GB

Hope this helps you to debug.

czar0 commented 7 years ago

@gokulamurthy I do not see in your docker registry a fabric-baseimage tagged as latest, so that can be the cause of your missing deployment. Run: docker tag hyperledger/fabric-baseimage:x86_64-0.2.1 hyperledger/fabric-baseimage:latest And try again.

To see the log of your docker containers, grab the ID from docker ps (looking for peer) and then run docker logs [ID]

gokulamurthy commented 7 years ago

@czar0 YAY, it works! its because of fabric-baseimage:latest was not there, please find below error found in log:

13:29:21.997 [nodeCmd] serve -> INFO 01b Starting peer with ID=name:"vp0" , network ID=dev, address=172.17.0.3:7051, rootnodes=, validator=true 13:29:21.997 [rest] StartOpenchainRESTServer -> INFO 01c Initializing the REST service on 0.0.0.0:7050, TLS is disabled. 2016/12/26 13:29:44 transport: http2Server.HandleStreams failed to receive the preface from client: EOF 13:29:52.868 [dockercontroller] deployImage -> ERRO 01d Error building images: Tag latest not found in repository docker.io/hyperledger/fabric-baseimage 13:29:52.868 [dockercontroller] deployImage -> ERRO 01e Image Output:


Step 1 : FROM hyperledger/fabric-baseimage Pulling repository docker.io/hyperledger/fabric-baseimage


13:30:00.173 [dockercontroller] deployImage -> ERRO 01f Error building images: Tag latest not found in repository docker.io/hyperledger/fabric-baseimage 13:30:00.173 [dockercontroller] deployImage -> ERRO 020 Image Output:


Step 1 : FROM hyperledger/fabric-baseimage Pulling repository docker.io/hyperledger/fabric-baseimage


13:30:00.173 [chaincode] Launch -> ERRO 021 launchAndWaitForRegister failed Error starting container: Tag latest not found in repository docker.io/hyperledger/fabric-baseimage 2016/12/26 13:30:14 transport: http2Server.HandleStreams failed to receive the preface from client: EOF

After Tagged to latest:

application log:

debug: -- Added testData debug: Login attempt w/ username: john1 info: [SDK] completed query: authenticate debug: verifying API call debug: Token approved -- Query all things -- info: [SDK] completed query: get_all_things Retrieved things from the blockchain: # 2 debug: verifying API call debug: Token approved -- Query thing -- info: [SDK] completed query: get_thing Retrieved thing from the blockchain debug: verifying API call debug: Token approved

Thanks you so much @czar0 I appreciate your prompt response and time.

Thanks -Gokul

raj040492 commented 7 years ago

Hi, I am facing the same issue.. But in my case npm run installgo throws an error

Failed at the server@0.0.0 gobuild script 'cd src/build-chaincode && GOPATH=$(pwd)/../.. && go build'

There was obviously an issue with my govend.. So I went straight to git repos of both devDependencies (i.e node-sass and node-demon) and did go get I see them in the respective directory but with a warning in my console "no executable found"

My problem still remains unresolved..

I know its slightly diffrernt from your situation..

But can you shed some light..

No one else is facing similar issue..