Есть код написанный на питоне с использованием библиотеки aiogram, установил хуки через ngrok, также сделал ендпоинты для этого микросервиса с помощью библиотеки fastapi. После последнего действия начал получать ошибку на любой запрос который поступает с телеграмма. Код ошибки:
INFO: Will watch for changes in these directories: ['/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/src/telegram']
INFO: Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
INFO: Started reloader process [35686] using StatReload
INFO: Started server process [35691]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 91.108.6.157:0 - "POST /6597101971%3AAAGVfoNca9NeP7xPtxcD1hntjin75VgRT6o HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/routing.py", line 758, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/routing.py", line 778, in app
await route.handle(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/routing.py", line 299, in handle
await self.app(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/starlette/routing.py", line 74, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/src/telegram/api/routers.py", line 39, in webhook_handler
return await webhook_requests_handler.handle(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/aiogram/webhook/aiohttp_server.py", line 196, in handle
return await self._handle_request_background(bot=bot, request=request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/davyd/MY_DATA/programming/tmp_project/p2p_exchanger/venv/lib64/python3.12/site-packages/aiogram/webhook/aiohttp_server.py", line 145, in _handle_request_background
bot=bot, update=await request.json(loads=bot.session.json_loads)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Request.json() got an unexpected keyword argument 'loads'
Код вызывающий ошибку внутри библиотеки aiohttp:
async def _handle_request_background(self, bot: Bot, request: web.Request) -> web.Response:
feed_update_task = asyncio.create_task(
self._background_feed_update(
bot=bot, update=await request.json(loads=bot.session.json_loads)
)
)
self._background_feed_update_tasks.add(feed_update_task)
feed_update_task.add_done_callback(self._background_feed_update_tasks.discard)
return web.json_response({}, dumps=bot.session.json_dumps)
Предполагаю что запросы которые поступают в веб приложение Fast Api этого микросервиса как-то неправильно обрабатываются, но я не понимаю как это можно решить.