我一直关注此Tutorial,我可以完成它。我向现有参与者发出新身份,并使用以下命令为此身份创建名片:
composer identity issue --card admin@tutorial-network -f usr001@tutorial-network.card -u usr001 -a "resource:org.acme.biznet.Trader#usr001" -x true
然后,我通过POST /wallet/import
导入该名片,我可以调用不同的REST API操作。之后,我停止composer-rest-server,几分钟后,我再次使用命令composer-rest-server -c admin@tutorial-network -m true -a true
然后,我使用配置的身份验证机制(在本例中为passport-github策略)对REST API进行身份验证,如果我尝试从REST API调用一个操作,则会抛出A business network card has not been specified
错误消息,然后导入上一张名片通过POST /wallet/import
获得no content
,这应该是正确的。
最后,当我尝试调用另一个REST API操作时,我收到以下错误:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity has not been registered: usr001)",
"stack": "Error: Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity has not been registered: usr001)\n at _checkRuntimeVersions.then.catch (/home/username/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:679:34)\n at <anonymous>"
}
}
这是主要问题,我不知道为什么我的身份没有被REST API识别,如果我之前用它来调用某些操作。
答案 0 :(得分:1)
问题是这里捕获的持久性问题 - &gt;此处捕获https://hyperledger.github.io/composer/v0.16/integrating/enabling-multiuser.html和持久身份(即说明)的链接 - &gt; https://hyperledger.github.io/composer/v0.16/integrating/deploying-the-rest-server.html
使用LoopBack连接器将所有用户信息保存在LoopBack数据源中。默认情况下,REST服务器使用LoopBack“内存”连接器来保留用户信息,这些信息在REST服务器终止时会丢失。 REST服务器应配置LoopBack连接器,该连接器将数据存储在高可用性数据源中,例如数据库。