IBM-Blockchain-Archive / marbles

WARNING: This repository is no longer maintained ⚠️ This repository will not be updated. The repository will be kept available in read-only mode.
Apache License 2.0
1.03k stars 979 forks source link

Chaincode install error #235

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hi I am getting error when installing marble chaincode in my local hyperledger network.

Error : sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: Stream removed Failed to obtain endorsement for transaction. code=2, , details=Stream removed

Please help me to resolve this issue.

Note : Docker version- 1.13.1 fabric_version 1.1.0

dshuffma-ibm commented 6 years ago

I haven't seen this one before, this grpc issue might be of help: https://github.com/grpc/grpc-node/issues/130

people seem to fix it by changing their grpc version. check out what version you have running by opening the file /node_modules/grpc/package.json, marbles should be using version 1.10.1

dshuffma-ibm commented 5 years ago

closing, inactivity

oumaima1234 commented 5 years ago

This problem is related to the use of grpc instead od grpcs.

You can correct it by changing grpc to grpcs in your code when you use nodejs SDK. If you do this, you will find a PEM error. To correct it you should add other arguments to "newPeer(...)" function.

you can adapt this piece of code to your code where you use the "newPeer" function and if you use the newOrderer function add the changes in the same way as newPeer.

code: to add and modify:

var fs = require('fs'); var path = require('path');

var firstnetwork_path = path.resolve('..', '..', 'first-network'); var org1tlscacert_path = path.resolve(firstnetwork_path, 'crypto-config', 'peerOrganizations', 'org1.example.com', 'tlsca', 'tlsca.org1.example.com-cert.pem'); var org1tlscacert = fs.readFileSync(org1tlscacert_path, 'utf8');

// var fabric_client = new Fabric_Client();

// setup the fabric network var channel = fabric_client.newChannel('mychannel'); var peer = fabric_client.newPeer('grpcs://localhost:7051', { 'ssl-target-name-override': 'peer0.org1.example.com', pem: org1tlscacert }); channel.addPeer(peer);

ebaizel commented 5 years ago

Thanks @oumaima1234. That did the trick. I didn't end up needing ssl-target-name-override as the cert matched the dns name.