<p>I m working on hyperledger blockchain and Kubernetes(minikube) on Ubuntu 18-04. In my network there two Organisations with one peer each and the orderer type is Solo. This whole network I deployed on minikube. Chaincode install and instantiation did successfully on pods. After that am trying to invoke by using SDK.</p>
<p>I am using the below code as invoke.js</p>
<pre><code>'use strict';

const { Gateway, Wallets } = require('fabric-network');
const fs = require('fs');
const path = require('path');

async function main() {
    try {
        // load the network configuration
        const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection1-org1.json');
        let ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8'));

        // Create a new file system based wallet for managing identities.
        const walletPath = path.join(process.cwd(), 'wallet');
        const wallet = await Wallets.newFileSystemWallet(walletPath);
        console.log(`Wallet path: ${walletPath}`);

        // Check to see if we've already enrolled the user.
        const identity = await wallet.get('user1');
        if (!identity) {
            console.log('An identity for the user &quot;user1&quot; does not exist in the wallet');
            console.log('Run the registerUser.js application before retrying');
            return;
        }
        
        // Create a new gateway for connecting to our peer node.
        const gateway = new Gateway();
         await gateway.connect(ccp, { wallet, identity: 'user1',discovery: { enabled: true, asLocalhost: true }  });
       
        // Get the network (channel) our contract is deployed to.
        const network = await gateway.getNetwork(channelname);
       
        // Get the contract from the network.
        const contract = network.getContract(contractname);
       
        // Submit the specified transaction.
        // createCar transaction - requires 5 argument, ex: ('createCar', 'CAR12', 'Honda', 'Accord', 'Black', 'Tom')
        // changeCarOwner transaction - requires 2 args , ex: ('changeCarOwner', 'CAR10', 'Dave')
        await contract.submitTransaction('arumnet','argument');
       
        console.log('Transaction has been submitted');

        // Disconnect from the gateway.
        await gateway.disconnect();

    } catch (error) {
        console.error(`Failed to submit transaction: ${error}`);
        process.exit(1);
    }
}

main();
</code></pre>
<p>configTx.yaml</p>
<pre><code>Organizations:
  - &amp;Orderer
    Name: Orderer
    ID: OrdererMSP
    MSPDir: ./crypto-config/ordererOrganizations/acme.com/msp
    # Policies are mandatory starting 2.x
    Policies: &amp;OrdererPolicies
      Readers:
          Type: Signature
          Rule: &quot;OR('OrdererMSP.member')&quot;
      Writers:
          Type: Signature
          Rule: &quot;OR('OrdererMSP.member')&quot;
      Admins:
          Type: Signature
          # ONLY Admin Role can carry out administration activities
          Rule: &quot;OR('OrdererMSP.admin')&quot;
      Endorsement:
          Type: Signature
          Rule: &quot;OR('OrdererMSP.member')&quot;

  - &amp;Acme
    Name: Acme
    ID: AcmeMSP
    MSPDir: ./crypto-config/peerOrganizations/acme.com/msp
    Policies: &amp;AcmePolicies
      Readers:
          Type: Signature
          # Any member can READ e.g., query
          Rule: &quot;OR('AcmeMSP.member')&quot;
      Writers:
          Type: Signature
          # Any member can WRITE e.g., submit transaction
          Rule: &quot;OR('AcmeMSP.member')&quot;
      Admins:
          Type: Signature
          # Either Acme admin OR Orderer Admin can carry out admin activities
          Rule: &quot;OR('AcmeMSP.admin')&quot;
      Endorsement:
          Type: Signature
          # Any member can act as an endorser
          Rule: &quot;OR('AcmeMSP.member')&quot;
    AnchorPeers:
      - Host: acme-peer-clusterip
        Port: 30751

  - &amp;Budget
    Name: Budget
    ID: BudgetMSP
    MSPDir: ./crypto-config/peerOrganizations/budget.com/msp
    Policies: &amp;BudgetPolicies
      Readers:
          Type: Signature
          # Any member
          Rule: &quot;OR('BudgetMSP.member')&quot;
      Writers:
          Type: Signature
          # Any member
          Rule: &quot;OR('BudgetMSP.member')&quot;
      Admins:
          Type: Signature
          # BOTH Budget Admin AND Orderer Admin needed for admin activities
          Rule: &quot;OR('BudgetMSP.member')&quot;
      Endorsement:
          Type: Signature
          Rule: &quot;OR('BudgetMSP.member')&quot;
    AnchorPeers:
      - Host: budget-peer-clusterip
        Port: 30851
</code></pre>
<p>Connection.json</p>
<pre><code>{
    &quot;name&quot;: &quot;first-network-acme&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;client&quot;: {
        &quot;organization&quot;: &quot;AcmeMSP&quot;,
        &quot;connection&quot;: {
            &quot;timeout&quot;: {
                &quot;peer&quot;: {
                    &quot;endorser&quot;: &quot;300&quot;
                }
            }
        }
    },
    &quot;organizations&quot;: {
        &quot;AcmeMSP&quot;: {
            &quot;mspid&quot;: &quot;AcmeMSP&quot;,
            &quot;peers&quot;: [
                
                &quot;peer1.acme.com&quot;
            ],
            &quot;certificateAuthorities&quot;: [
               
            ]
        }
    },
  
    &quot;channel&quot;:{
        &quot;airlinechannel&quot;:{
            &quot;orderers&quot;: [
                &quot;orderer.acme.com&quot;     
            ],
            &quot;peers&quot;: {
                &quot;peer1.acme.com&quot;: {}
            }
        }
    },
    &quot;peers&quot;: {
        &quot;peer1.acme.com&quot;: {
            &quot;url&quot;: &quot;grpc://10.109.214.71:3005&quot;,
            &quot;tlsCACerts&quot;: {
                &quot;pem&quot;: &quot;/crypto-config/peerOrganizations/acme.com/tlsca/tlsca.acme.com-cert.pem&quot;
            },
            &quot;grpcOptions&quot;: {
                &quot;ssl-target-name-override&quot;: &quot;peer1.acme.com&quot;,
                &quot;hostnameOverride&quot;: &quot;peer1.acme.com&quot;
            }
        }
    },
    &quot;certificateAuthorities&quot;: {
       
    }
}
</code></pre>
<p><em>Logs after running invoke.js</em></p>
<pre><code>2020-11-26T05:31:09.252Z | connectivity_state | dns:localhost:30751 CONNECTING -&gt; CONNECTING
2020-11-26T05:31:09.252Z | dns_resolver | Resolved addresses for target dns:localhost:30751: [127.0.0.1:30751]
2020-11-26T05:31:09.252Z | pick_first | IDLE -&gt; IDLE
2020-11-26T05:31:09.252Z | resolving_load_balancer | dns:localhost:30751 CONNECTING -&gt; IDLE
2020-11-26T05:31:09.253Z | connectivity_state | dns:localhost:30751 CONNECTING -&gt; IDLE
2020-11-26T05:31:09.253Z | pick_first | Connect to address list 127.0.0.1:30751
2020-11-26T05:31:09.253Z | subchannel | 127.0.0.1:30751 refcount 3 -&gt; 4
2020-11-26T05:31:09.253Z | pick_first | IDLE -&gt; TRANSIENT_FAILURE
2020-11-26T05:31:09.253Z | resolving_load_balancer | dns:localhost:30751 IDLE -&gt; TRANSIENT_FAILURE
2020-11-26T05:31:09.253Z | connectivity_state | dns:localhost:30751 IDLE -&gt; TRANSIENT_FAILURE
2020-11-26T05:31:12.254Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: acme-peer-clusterip:30751, url:grpc://localhost:30751, connected:false, connectAttempted:true
2020-11-26T05:31:12.254Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server acme-peer-clusterip:30751 url:grpc://localhost:30751 timeout:3000
2020-11-26T05:31:12.254Z - error: [DiscoveryService]: _buildPeer[dsg-test] - Unable to connect to the discovered peer acme-peer-clusterip:30751 due to Error: Failed to connect before the deadline on Endorser- name: acme-peer-clusterip:30751, url:grpc://localhost:30751, connected:false, connectAttempted:true
2020-11-26T05:31:12.261Z - error: [DiscoveryHandler]: _build_endorse_group_member &gt;&gt; G1:0 - returning an error endorsement, no endorsement made
2020-11-26T05:31:12.261Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
    peer=undefined, status=grpc, message=Endorsement has failed
Failed to submit transaction: Error: No valid responses from any peers. Errors:
    peer=undefined, status=grpc, message=Endorsement has failed
</code></pre>
<p><em>Below kubernetes pods setup</em>
<em>kubectl get all</em></p>
<pre><code>NAME                 READY   STATUS    RESTARTS   AGE
pod/acme-orderer-0   1/1     Running   0          107m
pod/acme-peer-0      2/2     Running   0          107m
pod/budget-peer-0    2/2     Running   0          107m

NAME                             TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                           AGE
service/acme-orderer-clusterip   ClusterIP      10.108.218.191   &lt;none&gt;           30750/TCP                         107m
service/acme-orderer-nodeport    NodePort       10.111.186.82    &lt;none&gt;           30750:30750/TCP                   107m
service/acme-peer-clusterip      ClusterIP      10.98.236.210    &lt;none&gt;           30751/TCP,30752/TCP               107m
service/acme-peer-nodeport       NodePort       10.101.38.254    &lt;none&gt;           30751:30751/TCP,30752:30752/TCP   107m
service/budget-peer-clusterip    ClusterIP      10.108.194.45    &lt;none&gt;           30851/TCP                         107m
service/budget-peer-nodeport     NodePort       10.100.136.250   &lt;none&gt;           30851:30851/TCP,30852:30852/TCP   107m
service/kubernetes               ClusterIP      10.96.0.1        &lt;none&gt;           443/TCP                           112m
service/svc-acme-orderer         LoadBalancer   10.105.155.207   10.105.155.207   6005:30696/TCP                    27m
service/svc-acme-peer            LoadBalancer   10.98.44.14      10.109.214.71      3005:30594/TCP                    56m

NAME                            READY   AGE
statefulset.apps/acme-orderer   1/1     107m
statefulset.apps/acme-peer      1/1     107m
statefulset.apps/budget-peer    1/1     10
</code></pre>

Piyusha Patel
<p>Some things to check:</p>
<ol>
<li><code>connection1-org1.json</code> - you've supplied <code>connection1-org1.json</code> in the code for <code>invoke.js</code> but <code>connection.json</code> config as a candidate you presumably expect to be used to load/access the network. Pls confirm if this is correct.</li>
<li><code>connection.json</code> - specifies a <code>tlsCACerts</code> but the url scheme used is <code>grpc://</code> rather than <code>grpcs://</code></li>
<li>connection.json - does not specify the orderer url. This may not be necessary if it is discoverable via other means</li>
<li>Is TLS enabled on the peers/orderer?</li>
</ol>
<p>If you can confirm/amend as necessary it will provide a better chance for someone to help.</p>
