fjc0k / docker-YApi

接口管理平台 YApi 的 Docker 镜像。
https://hub.docker.com/r/jayfong/yapi/tags
MIT License
1.1k stars 262 forks source link

初始化的时候报mongodb错误 #56

Closed Mingmingmew closed 4 years ago

Mingmingmew commented 4 years ago

YAPI_DB_SERVERNAME=10.211.55.21

yapi-web | http://127.0.0.1:3000/ yapi-web | log: mongodb load success... yapi-web | (node:1) UnhandledPromiseRejectionWarning: MongoError: command createIndexes requires authentication yapi-web | at Connection. (/yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:466:61) yapi-web | at Connection.emit (events.js:310:20) yapi-web | at processMessage (/yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connection.js:364:10) yapi-web | at Socket. (/yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connection.js:566:15) yapi-web | at Socket.emit (events.js:310:20) yapi-web | at addChunk (_stream_readable.js:286:12) yapi-web | at readableAddChunk (_stream_readable.js:268:9) yapi-web | at Socket.Readable.push (_stream_readable.js:209:10) yapi-web | at TCP.onStreamRead (internal/stream_base_commons.js:186:23) yapi-web | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) yapi-web | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. yapi-web | (node:1) UnhandledPromiseRejectionWarning: MongoError: command createIndexes requires authentication yapi-web | at Connection. (/yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:466:61) yapi-web | at Connection.emit (events.js:310:20)

Mingmingmew commented 4 years ago

经测试发现,只要一开始mongodb配置是错误的,然后再yaml里面重新配置正确的,然后docker-compose restart yapi-web docker里面的config.json 并不会刷新,所以只要第一次错了,之后修正了yaml也没用。希望能修复一下,谢谢。