title: Failed to invoke chaincode name:"lscc" , error: container exited with 1: chaincode registration failed (Fabric 1.4.1)
body: <p>I am trying to create a single org, single ca, single peer network, bootstrapped by the <code>nodejs-sdk</code>. I have used <a href="https://github.com/IBM/build-blockchain-insurance-app" rel="nofollow noreferrer">this sample</a> for reference.</p>
  
  <p>When I try to <code>instantiate()</code> the chaincode I get this error in the peer accessed by <code>docker logs ax-peer</code></p>
  
  <pre><code>2019-06-02 13:21:51.395 UTC [ledgermgmt] CreateLedger -&gt; INFO 028 Created ledger [default] with genesis block
  2019-06-02 13:21:51.401 UTC [gossip.gossip] JoinChan -&gt; INFO 029 Joining gossip network of channel default with 1 organizations
  2019-06-02 13:21:51.401 UTC [gossip.gossip] learnAnchorPeers -&gt; INFO 02a No configured anchor peers of AxOrgMSP for channel default to learn about
  2019-06-02 13:21:51.529 UTC [gossip.state] NewGossipStateProvider -&gt; INFO 02b Updating metadata information, current ledger sequence is at = 0, next expected block is = 1
  2019-06-02 13:21:51.531 UTC [sccapi] deploySysCC -&gt; INFO 02c system chaincode lscc/default(github.com/hyperledger/fabric/core/scc/lscc) deployed
  2019-06-02 13:21:51.532 UTC [cscc] Init -&gt; INFO 02d Init CSCC
  2019-06-02 13:21:51.532 UTC [sccapi] deploySysCC -&gt; INFO 02e system chaincode cscc/default(github.com/hyperledger/fabric/core/scc/cscc) deployed
  2019-06-02 13:21:51.532 UTC [qscc] Init -&gt; INFO 02f Init QSCC
  2019-06-02 13:21:51.532 UTC [sccapi] deploySysCC -&gt; INFO 030 system chaincode qscc/default(github.com/hyperledger/fabric/core/scc/qscc) deployed
  2019-06-02 13:21:51.532 UTC [sccapi] deploySysCC -&gt; INFO 031 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle) disabled
  2019-06-02 13:21:51.533 UTC [endorser] callChaincode -&gt; INFO 032 [][4f292791] Exit chaincode: name:"cscc"  (656ms)
  2019-06-02 13:21:51.533 UTC [comm.grpc.server] 1 -&gt; INFO 033 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:50128 grpc.code=OK grpc.call_duration=657.290863ms
  2019-06-02 13:21:51.541 UTC [endorser] callChaincode -&gt; INFO 034 [][3ae34d18] Entry chaincode: name:"lscc" 
  2019-06-02 13:21:51.542 UTC [endorser] callChaincode -&gt; INFO 035 [][3ae34d18] Exit chaincode: name:"lscc"  (0ms)
  2019-06-02 13:21:51.542 UTC [comm.grpc.server] 1 -&gt; INFO 036 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:50128 grpc.code=OK grpc.call_duration=940.979µs
  2019-06-02 13:21:51.550 UTC [endorser] callChaincode -&gt; INFO 037 [default][17bf8e2d] Entry chaincode: name:"lscc" 
  2019-06-02 13:21:51.550 UTC [endorser] callChaincode -&gt; INFO 038 [default][17bf8e2d] Exit chaincode: name:"lscc"  (1ms)
  2019-06-02 13:21:51.550 UTC [comm.grpc.server] 1 -&gt; INFO 039 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:50128 grpc.code=OK grpc.call_duration=1.690033ms
  2019-06-02 13:21:51.709 UTC [endorser] callChaincode -&gt; INFO 03a [][bc977c1f] Entry chaincode: name:"lscc" 
  2019-06-02 13:21:51.710 UTC [lscc] executeInstall -&gt; INFO 03b Installed Chaincode [ax-chaincode] Version [v2] to peer
  2019-06-02 13:21:51.710 UTC [endorser] callChaincode -&gt; INFO 03c [][bc977c1f] Exit chaincode: name:"lscc"  (1ms)
  2019-06-02 13:21:51.710 UTC [comm.grpc.server] 1 -&gt; INFO 03d unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:50128 grpc.code=OK grpc.call_duration=1.329134ms
  2019-06-02 13:21:51.738 UTC [endorser] callChaincode -&gt; INFO 03e [default][c3bbc09e] Entry chaincode: name:"lscc" 
  2019-06-02 13:21:57.532 UTC [gossip.election] beLeader -&gt; INFO 03f 7da5b667471b7350114ff369dd11eda7255c2c9de61dc64915fa01b0ca730def : Becoming a leader
  2019-06-02 13:21:57.532 UTC [gossip.service] func1 -&gt; INFO 040 Elected as a leader, starting delivery service for channel default
  2019-06-02 13:22:10.692 UTC [endorser] callChaincode -&gt; INFO 041 [default][c3bbc09e] Exit chaincode: name:"lscc"  (18954ms)
  2019-06-02 13:22:10.692 UTC [endorser] SimulateProposal -&gt; ERRO 042 [default][c3bbc09e] failed to invoke chaincode name:"lscc" , error: container exited with 1
  github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
      /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
  runtime.goexit
      /opt/go/src/runtime/asm_amd64.s:1333
  chaincode registration failed
  2019-06-02 13:22:10.693 UTC [comm.grpc.server] 1 -&gt; INFO 043 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:50128 grpc.code=OK grpc.call_duration=18.955253529s
  </code></pre>
  
  <p>No additional logs are being registered by the orderer. My code is as follows</p>
  
  <pre><code>
  const createClientInstance = async () =&gt; {
    let myClient = new client();
    const ordererConfig = {
      hostname: 'orderer0',
      url: 'grpc://localhost:7050',
      pem: readCryptoFile('ordererOrg.pem')
    };
    const orderer = myClient.newOrderer(ordererConfig.url, {
      pem: ordererConfig.pem,
      'ssl-target-name-override': ordererConfig.hostname
    });
  
    let peerConfig = {
      hostname: 'ax-peer',
      url: 'grpc://localhost:7051',
      eventHubUrl: 'grpc://localhost:7053',
      pem: readCryptoFile('axOrg.pem')
    };
    const defaultPeer = myClient.newPeer(peerConfig.url, {
      pem: peerConfig.pem,
      'ssl-target-name-override': peerConfig.hostname
    });
    myClient.setStateStore(await client.newDefaultKeyValueStore({
      path: './ax-peer'
    }))
  
    let user = await myClient.getUserContext('admin', true);
    if (user &amp;&amp; user.isEnrolled()) {
      console.log('Existing admin user used');
  
    } else {
      let url = 'http://localhost:7054'
      const ca = new CAClient(url, {
        verify: false
      });
  
      let enrollmentID = 'admin';
      let enrollmentSecret = 'adminpw';
      const enrollment = await ca.enroll({
        enrollmentID: 'admin',
        enrollmentSecret: 'adminpw'
      });
      user = new User(enrollmentID, myClient);
      await user.setEnrollment(enrollment.key, enrollment.certificate, 'AxOrgMSP');
    };
    await myClient.setUserContext(user);
  
    let adminUser = await myClient.createUser({
      username: `Admin@ax-peer`,
      mspid: 'AxOrgMSP',
      cryptoContent: {
        privateKeyPEM: readCryptoFile('Admin@ax-org-key.pem'),
        signedCertPEM: readCryptoFile('Admin@ax-org-cert.pem')
      }
    });
    let channelRes = await myClient.queryChannels(defaultPeer);
  
    // Create a new channel. Does not make you join it though
    let txId = myClient.newTransactionID();
    let envelope_bytes = fs.readFileSync('./channel.tx');
    var channelConfig = myClient.extractChannelConfig(envelope_bytes);
    let signature = myClient.signChannelConfig(channelConfig);
    const request = {
        name: 'default',
        orderer: orderer,
        config: channelConfig,
        signatures: [signature],
        txId: txId
      };
  
      await myClient.createChannel(request);
      let channel = myClient.newChannel('default');
      channel.addOrderer(orderer);
      channel.addPeer(defaultPeer);
      const genesisBlock = await channel.getGenesisBlock({ txId: myClient.newTransactionID() });
      let res = await channel.joinChannel({
          targets: [defaultPeer],
          txId: myClient.newTransactionID(),
          block: genesisBlock
        }, 120000);
  
      const installReq = {
        targets: [ defaultPeer ],
        chaincodePath: ccPath,
        chaincodeId:'ax-chaincode',
        chaincodeVersion: 'v2',
        chaincodeType: 'node'
      };
      let installRes = await myClient.installChaincode(installReq, 120000);
  
      let instantiateResponse = await channel.sendInstantiateProposal({
        targets: [ defaultPeer ],
        chaincodeId: 'ax-chaincode',
        chaincodeVersion: 'v2',
        chaincodeType: 'node',
        txId: myClient.newTransactionID()
      });
  
      // This fails
      console.log(instantiateResponse);
  };
  </code></pre>
  
  <p>Since the language is <code>node</code> I have to provide the absolute path to the chaincode. My folder structure is</p>
  
  <pre><code>- chaincode
    - src
      - ax-chaincode
        - package.json
        - index.js (fabric-contract-api used)
  - server
    - index.js (where I am calling the above code)
  </code></pre>
  
  <p>If I run <code>client.queryInstalledChaincodes(defaultPeer)</code> then it returns this log so I guess the chaincode is being installed.</p>
  
  <pre><code>{ chaincodes: 
     [ { name: 'ax-chaincode',
         version: 'v2',
         path: '/home/varun/Algorythmix/Core-Projects/ax-boilerplate/chaincode/src/ax-chaincode',
         input: '',
         escc: '',
         vscc: '',
         id: [Object] } ] }
  
  </code></pre>
  
  <p>How do I fix this? I want to stick to using <code>nodejs</code> and not change my chaincode to <code>golang</code>. The example also pulls the certificates and stores it in the root folder so it can be accessed without having to do <code>docker exec -it bash</code>.</p>