Composer 0.13.0 - 错误:缺少id

时间:2017-09-27 07:19:32

标签: hyperledger-composer

我的新版作曲家有问题。我的链码与0.11一起工作正常,现在有0.13,当我在链码之外添加资产时,我有错误:

Error: Missing id"

当然,ID在创建后会出现在新资产中; - )

当我将模拟代码放入链码中添加资产时,我有以下错误:

Error: Error trying invoke business network. Error: chaincode error (status: 500, message: Error: Object with ID 'Resource {id=zzz.yyy.xxx.tttt#e60e56d92a6928d3f4d1c5bc9bb828c3fc0a292c26ccc35935c594ac0e160c28}' in collection with ID 'Asset:zzz.yyy.xxx.tttt' does not exist)

这里是代码的摘录(没什么特别的)

return getAssetRegistry(NS + '.ttt')
    .then(function (tttRegistry) {

        // Create the asset
        var ttt = factory.newResource(NS, 'ttt', '12345');

        // Add new ttt
        return tttRegistry.add(ttt)
            .then(function () {

                // Emit an event

播放代码的标识是默认管理员用户

也许,我在日志中发现了一些东西,但我不知道如何解释它

2017-09-26T20:09:39.841Z ERROR   HLFConnectionManager    :fabric-client()          [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED)) at /home/hyperledger/node_modules/grpc/src/node/src/client.js:554:15 {}$
2017-09-26T20:09:39.842Z ERROR   HLFConnection           :queryChainCode()         {"message":"Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))","stack":"Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))\n    at channel.queryByChaincode.then.catch (/home/hyperledger/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:754:34)"}$
2017-09-26T20:09:39.842Z ERROR   HLFConnection           :ping()                   {"message":"Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))","stack":"Error: Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity must be activated (ACTIVATION_REQUIRED))\n    at _checkRuntimeVersions.then.catch (/home/hyperledger/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:668:34)"}$

我发现的唯一信息是这篇文章Hyperledger Composer:: Error: The current identity must be activated (ACTIVATION_REQUIRED),但就我而言,作曲家和包的版本是相同的

自从我从0.11升级到0.13后,我无法理解发生了什么

有什么想法吗?

3 个答案:

答案 0 :(得分:2)

我发现了问题的来源。 这不是设计问题或ACL的错误。

在Composer 0.11中,如果您与资产有关系,则在您的代码中,您可以直接访问其字段 在Composer 0.13中行为改变,与元素的关系只是一个参考,你不能直接访问它的字段

最糟糕的是,当您调用方法factory.newRelationship()时,错误不会增加,当您调用方法assetRegistry.add()

时会出现错误

所以要小心

答案 1 :(得分:0)

这听起来更像是模型的问题 - 您正在尝试创建一个具有必需字段id的资源,而您没有为该字段提供值。

您是否有可以包含的堆栈跟踪?

答案 2 :(得分:0)

如果默认规则 - "所有资源:"应设置为" zzz.yyy.xxx。*"

然后部署新更新的网络,然后重试。