Returned back from vacation to find this error when I try to run hyperledger fabric sample. It used to work just fine before I left on vacation. What gives?
WITSC02X6385JGH:fabric-ca sjain68$ docker logs -f dev-peer1-jnj-mycc-1.0 > chaincode@1.0.0 start /usr/local/src > node chaincode.js "--peer.address" "peer1-jnj:7052" E1219 23:48:19.159391389 19 ssl_transport_security.cc:238] Could not get common name of subject from certificate. { fcn: 'create', params: [ '00000' ] } SyntaxError: Unexpected token in JSON at position 0 at JSON.parse () at new ClientIdentity (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:246:27) at Chaincode.Invoke (/usr/local/src/chaincode.js:29:17)
Turns out there is some problem with v0.3.4 of X509 library that was released recently. Change dependencies to use 1.3.2 of fabric-shim and error should go away. 1.3.2 locks x509 version to 0.3.3. Writing this post to remind myself that the same code I wrote today may not work tomorrow. When that happens its usually a dependency problem – someone pulled the carpet from below my feet. So its better to always lock the versions of dependencies.
Btw The actual error that is happening here is
SyntaxError: Unexpected token in JSON at position 0 at JSON.parse () at new ClientIdentity (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:246:27) at Chaincode.Invoke (/usr/local/src/chaincode.js:29:17)
The E1219 23:48:19.159391389 19 ssl_transport_security.cc:238] Could not get common name of subject from certificate happens with any chaincode. It happens when following command is run:
> node chaincode.js “–peer.address” “peer1-jnj:7052”