Date
1 - 2 of 2
Node SDK TLS Gateway Connect - Error: PEM encoded certificate is required.
Nicholas Leonardi
Hey, Having an issue with the node sdk gateway connect for about 4 days now. This is the code that is attempting to connect with the peer with TLS enabled const connectionOptions: GatewayOptions = { wallet, identity: Admin@...', discovery: { enabled: false, asLocalhost: true } }; const connectionProfile = safeLoad(fs.readFileSync('connection.json', 'utf8')); const gateway: Gateway = new Gateway(); await gateway.connect(connectionProfile, connectionOptions); const network: Network = await gateway.getNetwork('channel'); const contract: Contract = network.getContract('chaincode'); And this is the connection.json { "name": "example-network", "version": "1.0.0", "client": { "organization": "Org1", "connection": { "timeout": { "peer": { "endorser": "300" }, "orderer": "300" } } }, "channels": { "examplechannel": { "orderers": [ "orderer.example.com" ], "peers": { "peer0.example.com": { "endorsingPeer": true, "chaincodeQuery": true, "ledgerQuery": true } } } }, "organizations": { "Org1": { "mspid": "N2miMSP", "peers": [ "peer0.example.com" ], "certificateAuthorities": [ "ca.example.com" ] } }, "orderers": { "orderer.example.com": { "url": "grpcs://192.168.68.133:7050", "tls_cacerts": { "path": "/usr/src/app/orderer-tls-rca-example-com-7054.pem" } } }, "peers": { "peer0.example.com": { "url": "grpcs://192.168.68.133:7051", "tls_cacerts": { "path": "/usr/src/app/tls-rca-example-com-7054.pem" } } }, "certificateAuthorities": { "rca.example.com": { "url": "https://192.168.68.133:7054", "caName": "rca.example.com", "httpOptions": { "verify": false }, "tlsCACerts": { "path": "/usr/src/app/tls-cert.pem" }, "registrar": [ { "enrollId": "admin", "enrollSecret": "adminpw" } ] } } } . Please any help would be appreciated. I don't know what else to do and I've been at it for 4 days. It seems he's not recognizing the PEM cert. |
|
Nicholas Leonardi
I managed to get past that error and go on to another. Instead of the path, I passed the certificate and got: Error: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: access denied for [GetConfigBlock][examplechannel]: Failed evaluating policy on signed data during check policy on channel [ examplechannel] with policy [/Channel/Application/Readers]: [implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Readers' sub-policies to be satisfied]
Em segunda-feira, 21 de outubro de 2019 15:42:59 BRT, Yacov Manevich <YACOVM@...> escreveu:
I have no clue in the gateway project,
but - I think maybe you should also attach to the email you certificate
that it claims to not be PEM encoded... From: "Nicholas Leonardi via Lists.Hyperledger.Org" <nlzanutim=yahoo.com@...> To: Hyperledger-fabric <hyperledger-fabric@...> Cc: fabric@... Date: 10/21/2019 09:39 PM Subject: [EXTERNAL] [Hyperledger Fabric] Node SDK TLS Gateway Connect - Error: PEM encoded certificate is required. Sent by: fabric@... Hey, Having an issue with the node sdk gateway connect for about 4 days now. This is the code that is attempting to connect with the peer with TLS enabled const connectionOptions: GatewayOptions = { wallet, identity: Admin@...', discovery: { enabled: false, asLocalhost: true } }; const connectionProfile = safeLoad(fs.readFileSync('connection.json', 'utf8')); const gateway: Gateway = new Gateway(); await gateway.connect(connectionProfile, connectionOptions); const network: Network = await gateway.getNetwork('channel'); const contract: Contract = network.getContract('chaincode'); And this is the connection.json { "name": "example-network", "version": "1.0.0", "client": { "organization": "Org1", "connection": { "timeout": { "peer": { "endorser": "300" }, "orderer": "300" } } }, "channels": { "examplechannel": { "orderers": [ "orderer.example.com" ], "peers": { "peer0.example.com": { "endorsingPeer": true, "chaincodeQuery": true, "ledgerQuery": true } } } }, "organizations": { "Org1": { "mspid": "N2miMSP", "peers": [ "peer0.example.com" ], "certificateAuthorities": [ "ca.example.com" ] } }, "orderers": { "orderer.example.com": { "url": "grpcs://192.168.68.133:7050", "tls_cacerts": { "path": "/usr/src/app/orderer-tls-rca-example-com-7054.pem" } } }, "peers": { "peer0.example.com": { "url": "grpcs://192.168.68.133:7051", "tls_cacerts": { "path": "/usr/src/app/tls-rca-example-com-7054.pem" } } }, "certificateAuthorities": { "rca.example.com": { "url": "https://192.168.68.133:7054", "caName": "rca.example.com", "httpOptions": { "verify": false }, "tlsCACerts": { "path": "/usr/src/app/tls-cert.pem" }, "registrar": [ { "enrollId": "admin", "enrollSecret": "adminpw" } ] } } } . Please any help would be appreciated. I don't know what else to do and I've been at it for 4 days. It seems he's not recognizing the PEM cert. |
|