Hyperledger composer TypeError:无法创建属性' wallet'在字符串' resumedevelop'

时间:2018-04-16 19:20:53

标签: node.js events hyperledger hyperledger-composer subscribe

我想订阅活动。 所以我制作了一个event.js文件

event.js

'use strict';


const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection;
const winston = require('winston');
var chalk = require('chalk');
let config = require('config').get('event-app');
let participantId = config.get('participantId');
let participantPwd = config.get('participantPwd');
const LOG = winston.loggers.get('application');

var connection = new BusinessNetworkConnection();
return connection.connect('admin@resumedevelop', 'resumedevelop', 'admin', 'adminpw')
    .then(function (definition) {
        // Retrieved Business Network Definition
        console.log(definition === connection.getBusinessNetwork());  // true
    });

"resumedevelop"是networkName

我经营一家BusinessNetwork 并试图 命令"节点event.js"

因此,

(node:28771) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot create property 'wallet' on string 'resumedevelop'

请给我建议..!

1 个答案:

答案 0 :(得分:0)

查看BusinessNetworkConnection的API参考我会说错误告诉您在预期对象时传递字符串作为第二个参数。

但我还会注意到,网络名称和凭证(或更可能的证书)是您作为第一个参数提供的业务网卡的一部分,因此您不需要指定这些额外的参数