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.
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$