首页 > 解决方案 > Hyperledger - Fabric 节点 SDK - 曲线属性错误

问题描述

将节点项目部署到 Heroku 时遇到问题。

得到一个来自 package.json 依赖项的持续错误fabri-client

错误是:"Cannot read property 'curve' of undefined"。我还不清楚为什么。

所有生成的文件都已经过验证(证书文件、pem 和所有配置文件)。它在生产和本地完全相等。

似乎是关于某些文件或属性无法读取的错误。我已经看了很多,什么也没找到。

2018-10-08T13:13:24.139587+00:00 app[web.1]: [31merror[39m: [Client.js]: Failed to load user "admin" from local key value store. Error: TypeError: Cannot read property 'curve' of undefined 2018-10-08T13:13:24.139597+00:00 app[web.1]: at Object.KEYUTIL.getKey (/app/node_modules/fabric-client/node_modules/jsrsasign/lib/jsrsasign.js:247:10378) 2018-10-08T13:13:24.139599+00:00 app[web.1]: at CryptoSuite_ECDSA_AES.getKey (/app/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27) 2018-10-08T13:13:24.139602+00:00 app[web.1]: at <anonymous> 2018-10-08T13:13:24.139737+00:00 app[web.1]: [31merror[39m: [Client.js]: Failed to load an instance of requested user "admin" from the state store on this Client instance. Error: TypeError: Cannot read property 'curve' of undefined 2018-10-08T13:13:24.139740+00:00 app[web.1]: at Object.KEYUTIL.getKey (/app/node_modules/fabric-client/node_modules/jsrsasign/lib/jsrsasign.js:247:10378) 2018-10-08T13:13:24.139742+00:00 app[web.1]: at CryptoSuite_ECDSA_AES.getKey (/app/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27) 2018-10-08T13:13:24.139743+00:00 app[web.1]: at <anonymous> 2018-10-08T13:13:24.140035+00:00 app[web.1]: ERRO: TypeError: Cannot read property 'curve' of undefined 2018-10-08T13:13:24.140037+00:00 app[web.1]: at Object.KEYUTIL.getKey (/app/node_modules/fabric-client/node_modules/jsrsasign/lib/jsrsasign.js:247:10378) 2018-10-08T13:13:24.140039+00:00 app[web.1]: at CryptoSuite_ECDSA_AES.getKey (/app/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27) 2018-10-08T13:13:24.140041+00:00 app[web.1]: at <anonymous> 2018-10-08T13:13:30.471688+00:00 heroku[router]: at=info method=POST path="/add_id" host=damp-lowlands-60646.herokuapp.com request_id=a13c1b5d-31f0-4e24-aabb-8733b102cf18 fwd="201.48.168.28" dyno=web.1 connect=1ms service=53ms status=500 bytes=322 protocol=https 2018-10-08T13:13:30.463089+00:00 app[web.1]: [31merror[39m: [Client.js]: Failed to load user "admin" from local key value store. Error: TypeError: Cannot read property 'curve' of undefined 2018-10-08T13:13:30.463101+00:00 app[web.1]: at Object.KEYUTIL.getKey (/app/node_modules/fabric-client/node_modules/jsrsasign/lib/jsrsasign.js:247:10378) 2018-10-08T13:13:30.463103+00:00 app[web.1]: at CryptoSuite_ECDSA_AES.getKey (/app/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27) 2018-10-08T13:13:30.463105+00:00 app[web.1]: at <anonymous> 2018-10-08T13:13:30.466974+00:00 app[web.1]: [31merror[39m: [Client.js]: Failed to load an instance of requested user "admin" from the state store on this Client instance. Error: TypeError: Cannot read property 'curve' of undefined 2018-10-08T13:13:30.466978+00:00 app[web.1]: at Object.KEYUTIL.getKey (/app/node_modules/fabric-client/node_modules/jsrsasign/lib/jsrsasign.js:247:10378) 2018-10-08T13:13:30.466980+00:00 app[web.1]: at CryptoSuite_ECDSA_AES.getKey (/app/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27) 2018-10-08T13:13:30.466982+00:00 app[web.1]: at <anonymous> 2018-10-08T13:13:30.468452+00:00 app[web.1]: Failed to invoke successfully :: TypeError: Cannot read property 'curve' of undefined

谢谢!

标签: javascriptnode.jsherokuhyperledger

解决方案


This is due to invalid/expired certificates in the fabric-client-kv-* folder.

Solution:

  1. Delete or backup the contents of the fabric-client-kv-* folder.
  2. Register Admin user again.
  3. Register the normal user now.

If you cant find the certificate folder, look for the line bellow in your program,

var store_path = path.join(__dirname, 'hfc-key-store');

or

  credentialStore:
    # [Optional]. Specific to FileKeyValueStore.js or similar implementations in other SDKs. Can be others
    # if using an alternative impl. For instance, CouchDBKeyValueStore.js would require an object
    # here for properties like url, db name, etc.
    path: "./fabric-client-kv-org1"

"hfc-key-store" or "fabric-client-kv-org1" is the folder containing the certificates.


推荐阅读