MongoClient.connect в Hyperledger Composer, похоже, выдает ошибку при попытке реализовать аутентификацию JWT - PullRequest
0 голосов
/ 06 декабря 2018

Когда я следовал учебнику и пытался запустить docker logs rest, выдается следующее сообщение об ошибке: Кажется, я не понимаю, почему

[2018-12-06 17:17:59] PM2 log: Launching in no daemon mode
[2018-12-06 17:17:59] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-12-06 17:17:59] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
(node:19) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

Ожидаемый результат:

docker logs rest
[2018-05-22 22:24:44] PM2 log: Launching in no daemon mode
[2018-05-22 22:24:44] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-05-22 22:24:44] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
Discovered types from business network definition
Generating schemas for all types in business network definition ...
Generated schemas for all types in business network definition
Adding schemas for all types to Loopback ...
Added schemas for all types to Loopback
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer

[Обновление]:

[2018-12-08 04:01:58] PM2 log: Launching in no daemon mode
[2018-12-08 04:01:58] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-12-08 04:01:58] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...

1 Ответ

0 голосов
/ 09 декабря 2018

, чтобы избавиться от предупреждающего сообщения, вам нужно добавить параметр, указанный в предупреждении, в переменную среды COMPOSER_DATASOURCES, например,

COMPOSER_DATASOURCES='{
   "db": {
     "name": "db", 
     "connector": "mongodb", 
     "host": "mongo", 
     "useNewUrlParser": "true"
   }
}'
...