问题描述
我正在尝试设置balance-transfer hyperledger fabric network。我已按照README.md中的步骤进行操作。运行./runApp.sh
时,出现以下错误。
Creating network "artifacts_default" with the default driver
Pulling ca.org1.example.com (hyperledger/fabric-ca:)...
ERROR: manifest for hyperledger/fabric-ca:latest not found: manifest unkNown: manifest unkNown
执行以下步骤后,解决了该问题。
docker pull hyperledger/fabric-ca:x86_64-1.1.0-preview
docker tag hyperledger/fabric-ca:x86_64-1.1.0-preview hyperledger/fabric-ca:latest
docker pull hyperledger/fabric-orderer:x86_64-1.1.0-preview
docker tag hyperledger/fabric-orderer:x86_64-1.1.0-preview hyperledger/fabric-orderer:latest
docker pull hyperledger/fabric-peer:x86_64-1.1.0-preview
docker tag hyperledger/fabric-peer:x86_64-1.1.0-preview hyperledger/fabric-peer:latest
在此步骤之后,./runApp.sh
命令成功。运行./testAPIs.sh -l golang
时,我在REST Server中收到以下错误。
[2020-08-25 09:08:41.463] [ERROR] Helper - Failed to get registered user: Barry with error: Error: fabric-ca request register Failed with errors [[ { code: 20,message: 'Authorization failure' } ]]
[2020-08-25 09:08:41.463] [DEBUG] SampleWebApp - -- returned from registering the username Barry for organization Org2
[2020-08-25 09:08:41.463] [DEBUG] SampleWebApp - Failed to register the username Barry for organization Org2 with::Failed Error: fabric-ca request register Failed with errors [[ { code: 20,message: 'Authorization failure' } ]]
UnauthorizedError: jwt malformed
at /var/www/html/fabric-samples/balance-transfer/node_modules/express-jwt/lib/index.js:102:22
at Object.module.exports [as verify] (/var/www/html/fabric-samples/balance-transfer/node_modules/express-jwt/node_modules/jsonwebtoken/verify.js:63:12)
at verifyToken (/var/www/html/fabric-samples/balance-transfer/node_modules/express-jwt/lib/index.js:100:13)
at fn (/var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:746:34)
at /var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:1213:16
at /var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:166:37
at /var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:706:43
at /var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:167:37
at Immediate._onImmediate (/var/www/html/fabric-samples/balance-transfer/node_modules/async/lib/async.js:1206:34)
at runcallback (timers.js:810:20)
我在fabric-ca中遇到以下错误。
2020/08/25 09:08:41 [INFO] 172.29.0.1:57476 POST /api/v1/enroll 200 0 "OK"
2020/08/25 09:08:41 [DEBUG] Received request for /api/v1/register
2020/08/25 09:08:41 [DEBUG] Received registration request from : { Name:Barry Type: Secret:**** MaxEnrollments:1 Affiliation:org2.department1 Attributes:[] CAName:ca-org2 }
2020/08/25 09:08:41 [DEBUG] Sent error for /api/v1/register: scode: 401,local code: 25,local msg: Invalid token in authorization header: Token signature validation Failed,remote code: 20,remote msg: Authorization failure
github.com/hyperledger/fabric-ca/lib.newAuthErr
/opt/gopath/src/github.com/hyperledger/fabric-ca/lib/servererror.go:145
github.com/hyperledger/fabric-ca/lib.(*serverRequestContext).TokenAuthentication
/opt/gopath/src/github.com/hyperledger/fabric-ca/lib/serverrequestcontext.go:129
github.com/hyperledger/fabric-ca/lib.registerHandler
/opt/gopath/src/github.com/hyperledger/fabric-ca/lib/serverregister.go:49
github.com/hyperledger/fabric-ca/lib.(*serverEndpoint).ServeHTTP
/opt/gopath/src/github.com/hyperledger/fabric-ca/lib/serverendpoint.go:44
net/http.(*ServeMux).ServeHTTP
/opt/go/src/net/http/server.go:2254
net/http.serverHandler.ServeHTTP
/opt/go/src/net/http/server.go:2619
net/http.(*conn).serve
/opt/go/src/net/http/server.go:1801
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2337
2020/08/25 09:08:41 [INFO] 172.29.0.1:57480 POST /api/v1/register 401 25 "Invalid token in authorization header: Token signature validation Failed"
请帮助我解决此问题。
解决方法
这里的问题很少出现:
- 您正在使用3岁的
number
版本。但是在您提到的问题中,您使用的是hyperledger-fabric
。检查here您的版本信息。 - 您可以将
v1.4
,1.4.8
,ca
的标记peer
代替orderer
。 -
x86_64-1.1.0-preview
标签具有误导性,因为现在有两个Hyperledger-fabric版本,即latest
和fabric:v2.x
。因此,更好的方法是使用特定标签而不是fabric:v1.4.x
。