Hyperledger Composer REST API出现“ transactionId”:“ string”

时间:2019-03-18 16:10:34

标签: hyperledger-composer

将浏览器连接到Hyperledger Composer中的REST API时出现此问题。尝试发布目标时,它将出现一个新字段,称为“ transactionId”:“ string”和“ timestamp2:

{
  "$class": "org.cryptolab.economiassociales.AnadirNodo",
  "idNodo": "string",
  "nombre": "string",
  "localizacion": "string",
  "delegada": "string",
  "numeroMiembrosParticipantes": 0,
  "transactionId": "string",
  "timestamp": "2019-03-18T15:55:40.857Z"
}

尝试填充transactionId字符串,事务失败,并显示422错误代码:

{
  "error": {
    "statusCode": 422,
    "name": "ValidationError",
    "message": "The `AnadirNodo` instance is not valid. Details: `transactionId` can't be set (value: \"s1\").",
    "details": {
      "context": "AnadirNodo",
      "codes": {
        "transactionId": [
          "absence"
        ]
      },
      "messages": {
        "transactionId": [
          "can't be set"
        ]
      }
    },
    "stack": "ValidationError: The `AnadirNodo` instance is not valid. Details: `transactionId` can't be set (value: \"s1\").\n    at /home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:400:12\n    at AnadirNodo.<anonymous> (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:578:11)\n    at AnadirNodo.next (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:93:12)\n    at AnadirNodo.<anonymous> (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:575:23)\n    at AnadirNodo.trigger (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:83:12)\n    at AnadirNodo.Validatable.isValid (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:541:8)\n    at /home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:396:9\n    at doNotify (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n    at doNotify (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n    at doNotify (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n    at doNotify (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n    at Function.ObserverMixin._notifyBaseObservers (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n    at Function.ObserverMixin.notifyObserversOf (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n    at Function.ObserverMixin._notifyBaseObservers (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)\n    at Function.ObserverMixin.notifyObserversOf (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n    at Function.ObserverMixin._notifyBaseObservers (/home/hyperledger/.nvm/versions/node/v8.15.1/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)"
  }
}

似乎与此主题类似: transactionId when submitting a transaction

我该怎么办?真令人沮丧...

谢谢!

1 个答案:

答案 0 :(得分:0)

请参见Post 答案。如下发布交易:

{
  "$class": "org.cryptolab.economiassociales.AnadirNodo",
  "idNodo": "string",
  "nombre": "string",
  "localizacion": "string",
  "delegada": "string",
  "numeroMiembrosParticipantes": 0
}

希望它会对您有所帮助:)