Hyperledger fabric 未定义的不可调用

Hyperledger fabric 未定义的不可调用,hyperledger-fabric,hyperledger-composer,Hyperledger Fabric,Hyperledger Composer,我正在写一个交易,向网络添加一个参与者和一个资产。将参与者添加到网络是可行的,但当我尝试访问医疗资产文件注册表时,函数返回undefined 错误:类型错误:未定义不可调用 交易的逻辑: return getParticipantRegistry(namespace + '.Patient') .then(function (patientRegistry) { return patientRegistry.add(newPatient);

我正在写一个交易,向网络添加一个参与者和一个资产。将参与者添加到网络是可行的,但当我尝试访问医疗资产文件注册表时,函数返回undefined

错误:类型错误:未定义不可调用

交易的逻辑:

return getParticipantRegistry(namespace + '.Patient')
        .then(function (patientRegistry) {
            return patientRegistry.add(newPatient);
        }).then(function() {
            return getAssetRegistry('nl.epd.blockchain.MedicalFile');
        }).then(function (registry) {
            var medicalFile = factory.newResource(namespace, 'MedicalFile', "test");
            medicalFile.id = "test";
            medicalFile.owner = newPatient.bsn;
            medicalFile.mentors = [];
            medicalFile.permissions = [];
            medicalFile.allergies = [];
            medicalFile.treatments = [];
            medicalFile.medicine = [];

            // registry is undefined
            return registry.add(medicalFile);
        });
}
型号:

namespace nl.epd.blockchain

asset MedicalFile identified by id {
  o String                      id
  --> Patient                   owner
  --> Patient[]                 mentors
  o OrganisationPermission[]  permissions
  o Visit[]                   visits
  o String[]                  allergies
  o Treatment[]               treatments
  o Medicine[]                medicine
}

participant Patient identified by bsn {
  o String bsn
  o String firstName
  o String namePrefix optional
  o String lastName
  o String email
  o String telephoneNumber
  o String birthday
  o String gender
  o String city
  o String zipCode
  o String street
  o String houseNumber
  o String houseNumberExtra optional
}
NPM依赖项:

"dependencies": {
    "fabric-ca-client": "1.0.0-alpha.0",
    "fabric-client": "1.0.0-alpha",
    "homedir": "^0.6.0",
    "composer-client": "^0.7.0",
    "composer-rest-server": "^0.7.0"
  }

知道怎么回事吗?

注册表为空的假设是不正确的。问题是,店主不是恋人。这只是一根绳子,我想这是允许的

这导致了上述错误

修复方法:

medicalFile.owner = factory.newRelationship(namespace, 'Patient', newPatient.bsn);