7.1.3 of the Tutorial (page 188) v2.0.0 pdf


Trevor Lee Oakley <trevor@...>
 

I am working via the fabcar examples and I have an error; I can register the admin user and I get the wallet entry. But when I try and use node registerUser.js I get an error (below) - not a function. I did not change anything and the network is running, it has the CA working. 
 
 
:~/fabric-samples/fabcar/javascript/wallet$ ll
total 12
drwxrwxr-x 2 ubuntu ubuntu 4096 Feb 17 03:40 ./
drwxrwxr-x 4 ubuntu ubuntu 4096 Feb 17 03:46 ../
-rw-rw-r-- 1 ubuntu ubuntu    0 Feb 15 08:00 .gitkeep
-rw-rw-r-- 1 ubuntu ubuntu 1121 Feb 16 12:07 admin.id
 
 
~/fabric-samples/fabcar/javascript$ node registerUser.js 
Wallet path: /home/ubuntu/fabric-samples/fabcar/javascript/wallet
Failed to register user "user1": TypeError: gateway.getClient is not a function
 
 
     const gateway = new Gateway();
        await gateway.connect(ccpPath, { wallet, identity: 'admin', discovery: { enabled: true, asLocalhost: true } });
        // Get the CA client object from the gateway for interacting with the CA.
        const client = gateway.getClient();
        const ca = client.getCertificateAuthority();
        const adminUser = await client.getUserContext('admin', false);
 
 
I get this for Gateway for a console.log -
 
Gateway {
  client: Client {
    type: 'Client',
    name: 'gateway client',
    mspid: null,
    _tls_mutual: {
      selfGenerated: true,
      clientKey: '-----BEGIN PRIVATE KEY-----\r\n' +
        'MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgZVYzMEW42hnKm2D5\r\n' +
        'LsjRAMK3iQG34lrB1oF3j6C/n06hRANCAAR6es5QJNc1WdgC9hVRyEnl/YHeYtk4\r\n' +
        'lexkh++nGRtspkmb0UIB/EY9E5LPh/SXEcbTZm6II81TZNdm3e3NASjO\r\n' +
        '-----END PRIVATE KEY-----\r\n',
      clientCert: '-----BEGIN CERTIFICATE-----\r\n' +
        'MIIBVTCB+6ADAgECAgEEMAoGCCqGSM49BAMCMBgxFjAUBgNVBAMMDWZhYnJpYy1j\r\n' +
        'b21tb24wIhgPMjAyMDAyMTcwMjMxMjhaGA8yMDIwMDIxNzIwMzQ0OFowGDEWMBQG\r\n' +
        'A1UEAwwNZmFicmljLWNvbW1vbjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHp6\r\n' +
        'zlAk1zVZ2AL2FVHISeX9gd5i2TiV7GSH76cZG2ymSZvRQgH8Rj0Tks+H9JcRxtNm\r\n' +
        'bogjzVNk12bd7c0BKM6jMjAwMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgbAMBMG\r\n' +
        'A1UdJQQMMAoGCCsGAQUFBwMCMAoGCCqGSM49BAMCA0kAMEYCIQCQkeSzqt3LI747\r\n' +
        'NG7WWP9hNU+aVi82+XT1eyfbzjgriwIhAOnXOCVrAmQtpANJFXs/4sDbQ7ozQlBy\r\n' +
        'U4/YRulyQXUN\r\n' +
        '-----END CERTIFICATE-----\r\n'
    },
    endorsers: Map {},
    committers: Map {},
    channels: Map {},
    centralizedOptions: null
  },
  wallet: null,
  identityContext: IdentityContext {
    type: 'IdentityContext',
    client: Client {
      type: 'Client',
      name: 'gateway client',
      mspid: null,
      _tls_mutual: [Object],
      endorsers: Map {},
      committers: Map {},
      channels: Map {},
      centralizedOptions: null
    },
    user: User {
      type: 'User',
      _name: 'admin',
      _roles: null,
      _affiliation: '',
      _enrollmentSecret: '',
      _identity: [Identity],
      _signingIdentity: [SigningIdentity],
      _mspId: 'Org1MSP',
      _cryptoSuite: [CryptoSuite_ECDSA_AES]
    },
    options: {},
    name: 'admin',
    mspid: 'Org1MSP',
    transactionId: null,
    nonce: null
  },
  networks: Map {},
  options: {
    query: { timeout: 30, strategy: [Function: MSPID_SCOPE_SINGLE] },
    transaction: {
      endorseTimeout: 30,
      commitTimeout: 300,
      strategy: [Function: MSPID_SCOPE_ALLFORTX]
    },
    discovery: { enabled: true, asLocalhost: true },
    wallet: Wallet {
      providerRegistry: [IdentityProviderRegistry],
      store: [FileSystemWalletStore]
    },
    identity: 'admin'
  }
}
Failed to register user "user1": TypeError: gateway.getClient is not a function
ubuntu@ip-10-0-1-151:~/fabric-samples/fabcar/javascript$ 
 

Join fabric@lists.hyperledger.org to automatically receive all group messages.