ssttkkl / PixivBot

集成插件nonebot-plugin-pixivbot的NoneBot实例的Docker镜像,适用于Docker方式部署。
MIT License
258 stars 16 forks source link

启动bot时连接mongodb报错,提示<Future finished exception=OperationFailure("Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}")> #35

Closed Noctulus closed 2 years ago

Noctulus commented 2 years ago

完整日志如下:


Future exception was never retrieved
future: <Future finished exception=OperationFailure("Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1394, in _get_socket
    sock_info = self.sockets.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pymongo/collection.py", line 2101, in create_index
    return self.__create_indexes([index], session, **cmd_options)[0]
  File "/usr/local/lib/python3.9/site-packages/pymongo/collection.py", line 1961, in __create_indexes
    with self._socket_for_writes(session) as sock_info:
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1308, in _get_socket
    with server.get_socket(
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1331, in get_socket
    sock_info = self._get_socket(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1397, in _get_socket
    sock_info = self.connect(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1297, in connect
    sock_info.check_auth(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 820, in check_auth
    self.authenticate(credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 837, in authenticate
    auth.authenticate(credentials, self)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 672, in authenticate
    auth_func(credentials, sock_info)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 590, in _authenticate_default
    return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 295, in _authenticate_scram
    res = sock_info.command(source, cmd)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 710, in command
    return command(self, dbname, spec, secondary_ok,
  File "/usr/local/lib/python3.9/site-packages/pymongo/network.py", line 161, in command
    helpers._check_command_response(
  File "/usr/local/lib/python3.9/site-packages/pymongo/helpers.py", line 167, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}
[2022-07-05 17:45:25 +0800] [8] [ERROR] Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1394, in _get_socket
    sock_info = self.sockets.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/src/plugins/nonebot-plugin-pixivbot/data_source/mongo_conn.py", line 22, in _ensure_cache_index
    await db[coll_name].create_index(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pymongo/collection.py", line 2101, in create_index
    return self.__create_indexes([index], session, **cmd_options)[0]
  File "/usr/local/lib/python3.9/site-packages/pymongo/collection.py", line 1961, in __create_indexes
    with self._socket_for_writes(session) as sock_info:
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1308, in _get_socket
    with server.get_socket(
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1331, in get_socket
    sock_info = self._get_socket(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1397, in _get_socket
    sock_info = self.connect(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1297, in connect
    sock_info.check_auth(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 820, in check_auth
    self.authenticate(credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 837, in authenticate
    auth.authenticate(credentials, self)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 672, in authenticate
    auth_func(credentials, sock_info)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 590, in _authenticate_default
    return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 295, in _authenticate_scram
    res = sock_info.command(source, cmd)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 710, in command
    return command(self, dbname, spec, secondary_ok,
  File "/usr/local/lib/python3.9/site-packages/pymongo/network.py", line 161, in command
    helpers._check_command_response(
  File "/usr/local/lib/python3.9/site-packages/pymongo/helpers.py", line 167, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 621, in lifespan
    async with self.lifespan_context(app):
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 518, in __aenter__
    await self._router.startup()
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 598, in startup
    await handler()
  File "/app/src/plugins/nonebot-plugin-pixivbot/data_source/mongo_conn.py", line 43, in connect_to_mongodb
    await _ensure_cache_index(db, 'download_cache', "illust_id", conf.pixiv_download_cache_expires_in)
  File "/app/src/plugins/nonebot-plugin-pixivbot/data_source/mongo_conn.py", line 25, in _ensure_cache_index
    await db.command({
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pymongo/database.py", line 757, in command
    with self.__client._socket_for_reads(
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1389, in _socket_for_reads
    with self._get_socket(server, session) as sock_info:
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1308, in _get_socket
    with server.get_socket(
  File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1331, in get_socket
    sock_info = self._get_socket(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1397, in _get_socket
    sock_info = self.connect(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 1297, in connect
    sock_info.check_auth(all_credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 820, in check_auth
    self.authenticate(credentials)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 837, in authenticate
    auth.authenticate(credentials, self)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 672, in authenticate
    auth_func(credentials, sock_info)
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 590, in _authenticate_default
    return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/usr/local/lib/python3.9/site-packages/pymongo/auth.py", line 295, in _authenticate_scram
    res = sock_info.command(source, cmd)
  File "/usr/local/lib/python3.9/site-packages/pymongo/pool.py", line 710, in command
    return command(self, dbname, spec, secondary_ok,
  File "/usr/local/lib/python3.9/site-packages/pymongo/network.py", line 161, in command
    helpers._check_command_response(
  File "/usr/local/lib/python3.9/site-packages/pymongo/helpers.py", line 167, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}
ssttkkl commented 2 years ago

文档忘记更新了,重新按照文档创建env-file.txt然后启动bot容器就好