title: Hyperledger Composer returns error No ledger context for GetState
body: <p>I am currently developing a transaction in Hyperledger composer. This transaction is going to create 2 different Assets : Asset A and Asset B.
  Asset A has a field with the type Asset B. So I first need to create Asset B and then create Asset A with a link to Asset B. I have managed to implement the logic, after a few struggles. Now the peer returns the following error :</p>
  <blockquote>
  <p>2018-10-10T14:06:14.022Z [5ad2a944] DEBUG    :NodeDataCollection       :add()                     &gt; assetAIdValue, {&quot;$class&quot;: &quot;mynamespace.assetA&quot;,&quot;assetAId&quot;: &quot;assetAIdValue&quot;,&quot;assetAFieldX&quot;: &quot;assetAFieldXValue&quot;,&quot;assetB&quot;: [&quot;resource:mynamespace.assetB#assetBIdValue1&quot;, &quot;resource:mynamespace.assetB#assetBIdValue2&quot;]},&quot;$registryType&quot;:&quot;Asset&quot;,&quot;$registryId&quot;:&quot;mynamespace.assetA&quot;}, false</p>
  <p>(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Error when creating AssetA with id assetAIdValue</p>
  <p>Error: [5ad2a944]No ledger context for GetState. Sending ERROR</p>
  </blockquote>
  <p>Here is my model</p>
  <pre><code>namespace mynamespace
  
  /**
   * Definition of createAssetA transaction
   */
  transaction createAssetA{
    o String assetAId
    o String assetAFieldX
    o AssetB[] assetB
  }
  
  /**
   * Definition of AssetA asset
   */
  asset AssetA identified by assetAId{
    o String assetAId
    o String assetAFieldX
    --&gt; AssetB[] assetB
  }
  
  /**
   * Definition of assetB asset
   */
  asset AssetB identified by AssetBId{
    o String assetBId
    o String assetBFieldX
    o String assetBFieldY
  }
  </code></pre>
  <p>Here is my logic.js</p>
  <pre><code>/**
  * Creates the assets assetB and assetA
  * @param {mynamespace.createAssetA} createAssetA - the AssetA to create
  * @transaction
  */
  function createAssetA(createAssetA) {
      return getAssetRegistry('mynamespace.AssetB')
          .then(function (assetBRegistry) {
              // Add all the AssetBs to the AssetB registry
              assetBRegistry.addAll(createAssetA.assetB)
                  .then(function(){
                      addAssetA(createAssetA);
                  }, function(error) {
                      throw new Error ('Error while creating AssetBs' + '\n' + error);
                  } );
          });
  }
  
  /**
   * Function to add assetA asset to registry
   * @param {*} createAssetA - The createAssetA Transaction containing the assetA info
   */
  function addAssetA(createAssetA){
      return getAssetRegistry('mynamespace.AssetA')
          .then(function (assetARegistry) {
              var newAssetA = castcreateAssetATxToAsset(createAssetA);
              return assetARegistry.add(newAssetA).catch(function (error) {
                  throw new Error ('Error when creating AssetA with id ' + createAssetA.id + '\n' + error);
              });
          });
  }
  
  /**
   * Casts the createAssetA transaction as a AssetA Asset
   * @param {*} createAssetA - The transaction createAssetA to cast
   * @returns {mynamespace.AssetA} the AssetA Asset with the info from the createAssetA param
   */
  function castcreateAssetATxToAsset(createAssetA){
      var factory = getFactory();
      // Create a new instance of AssetA class from the mynamespace namespace with the id createAssetA.id
      var newAssetA = factory.newResource('mynamespace', 'AssetA', createAssetA.id);
      newAssetA.assetAFieldX = createAssetA.assetAFieldX;
      newAssetA.assetB = [];
      for (var i = 0; i &lt; createAssetA.assetB.length; i++) {
          var assetB = factory.newRelationship('mynamespace', 'assetB', createAssetA.assetB[i].id);
          newAssetA.assetB[i] = assetB;
      }
      return newAssetA;
  }
  </code></pre>
  <p>And here is the content of my request</p>
  <pre><code>{
   &quot;$class&quot;: &quot;mynamespace.createAssetA&quot;,
   &quot;assetAId&quot;: &quot;assetAIdValue&quot;,
   &quot;assetAFieldX&quot;: &quot;assetAFieldXValue&quot;,
   &quot;assetB&quot;: [
    {
     &quot;$class&quot;: &quot;mynamespace.assetB&quot;,
     &quot;assetBId&quot;: &quot;assetBIdValue1&quot;,
     &quot;assetBFieldX&quot;: &quot;assetBFieldXValue&quot;,
     &quot;assetBFieldY&quot;: &quot;assetBFieldYValue&quot;
    },
    {
     &quot;$class&quot;: &quot;mynamespace.assetB&quot;,
     &quot;assetBId&quot;: &quot;assetBIdValue2&quot;,
     &quot;assetBFieldX&quot;: &quot;assetBFieldXValue&quot;,
     &quot;assetBFieldY&quot;: &quot;assetBFieldYValue&quot;
    }
   ]
  }
  </code></pre>
  <p>If anyone new the cause for such an error he would save my day !</p>
  <p><strong>Another question</strong> :
  This error is only visible when I look at the chaincode containers. Anybody knows how I can make them visible from the Composer REST Server?</p>