lgc-NB2Dev / nonebot-plugin-picstatus

运行状态图片版 for NoneBot2 / A NoneBot2 plugin generates a picture which shows the status of current device
MIT License
117 stars 11 forks source link

本地运行正常,但部署时抛出错误 #51

Closed yeqiu6080 closed 4 hours ago

yeqiu6080 commented 5 hours ago

本地运行正常,但部署时抛出如下错误

10-26 14:27:35 [SUCCESS] nonebot | Running NoneBot...
10-26 14:27:35 [INFO] uvicorn | Started server process [7268]
10-26 14:27:35 [INFO] uvicorn | Waiting for application startup.
10-26 14:27:35 [INFO] nonebot_plugin_apscheduler | Scheduler Started
10-26 14:27:35 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender"
10-26 14:27:38 [WARNING] apscheduler | Run time of job "_ (trigger: interval[0:00:02], next run at: 2024-10-26 14:27:37 CST)" was missed by 0:00:02.752508
10-26 14:27:42 [WARNING] apscheduler | Execution of job "_ (trigger: interval[0:00:02], next run at: 2024-10-26 14:27:39 CST)" skipped: maximum number of running instances reached (1)
10-26 14:27:46 [WARNING] apscheduler | Execution of job "_ (trigger: interval[0:00:02], next run at: 2024-10-26 14:27:45 CST)" skipped: maximum number of running instances reached (1)
10-26 14:27:46 [ERROR] nonebot_plugin_picstatus | Error when getting background, fallback to local
Traceback (most recent call last):
  File "I:\Speechless\.venv\lib\site-packages\httpx\_transports\default.py", line 72, in map_httpcore_exceptions
    yield
  File "I:\Speechless\.venv\lib\site-packages\httpx\_transports\default.py", line 377, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\connection.py", line 101, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\http11.py", line 143, in handle_async_request
    raise exc
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\http11.py", line 113, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\http11.py", line 186, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
  File "I:\Speechless\.venv\lib\site-packages\httpcore\_async\http11.py", line 238, in _receive_event
    raise RemoteProtocolError(msg)
httpcore.RemoteProtocolError: Server disconnected without sending a response.

>The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "I:\Speechless\bot.py", line 128, in <module>
    nonebot.run()
  File "I:\Speechless\.venv\lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "I:\Speechless\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "I:\Speechless\.venv\lib\site-packages\uvicorn\main.py", line 579, in run
    server.run()
  File "I:\Speechless\.venv\lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1906, in _run_once
    handle._run()
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "I:\Speechless\.venv\lib\site-packages\nonebot_plugin_picstatus\bg_provider.py", line 157, in task_func
    bg = await fetch_bg()
> File "I:\Speechless\.venv\lib\site-packages\nonebot_plugin_picstatus\bg_provider.py", line 121, in fetch_bg
    return await registered_bg_providers[config.ps_bg_provider]()
  File "I:\Speechless\.venv\lib\site-packages\nonebot_plugin_picstatus\bg_provider.py", line 68, in loli
    (await cli.get("https://www.loliapi.com/acg/pe/")).raise_for_status(),
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1814, in get
    return await self.request(
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1585, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1674, in send
    response = await self._send_handling_auth(
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1702, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1739, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "I:\Speechless\.venv\lib\site-packages\httpx\_client.py", line 1776, in _send_single_request
    response = await transport.handle_async_request(request)
  File "I:\Speechless\.venv\lib\site-packages\httpx\_transports\default.py", line 376, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\seewo\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "I:\Speechless\.venv\lib\site-packages\httpx\_transports\default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: Server disconnected without sending a response.
yeqiu6080 commented 5 hours ago

然后日志输出

10-26 14:27:46 [INFO] nonebot_plugin_htmlrender | 使用 chromium 启动 10-26 14:27:47 [INFO] nonebot_pluginhtmlrender | Browser Started. 10-26 14:27:47 [INFO] uvicorn | Application startup complete. 10-26 14:27:47 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:1451 (Press CTRL+C to quit) 10-26 14:27:50 [WARNING] apscheduler | Execution of job " (trigger: interval[0:00:02], next run at: 2024-10-26 14:27:49 CST)" skipped: maximum number of running instances reached (1)

XieXiLin2 commented 4 hours ago

你的 Bot 机子无法连接到 loli 的 api,或由于你配置的 proxy 无法让你连接到 loli 的 api,建议你切换 bg_provider,详见: https://github.com/lgc2333/nonebot-plugin-picstatus/blob/master/.env.example#L34-L42