実現したいこと
Line botの開発の練習の過程で、以下の公式のSampleコードをそのままRenderの無料サーバーを使って実装しようとしています。
https://github.com/line/line-bot-sdk-python/blob/master/examples/fastapi-echo/main.py
しかしながら、500エラーと以下のようなログが発生してしまい、その解決方法と、可能であればどのような点に着目して解決すれば良いかご教授頂きたいです。
周辺情報
- python 3.11
- Fast API
- line_bot_sdk
実装したい機能
公式Lineに「メッセージ」を送ると同じ「メッセージ」を送り返す
すでに確認した事項
Line Developerの管理画面からwebhookの「検証」ボタンを押すと、Renderのログには200が表示されているため通信ができていることは確認が取れたと考えています
発生している問題・エラーメッセージ
"POST /callback HTTP/1.1" 200 # 「検証」ボタンを押した時 "POST /callback HTTP/1.1" 500 # 公式ラインにメッセージを送った時 [41] [ERROR] Exception in ASGI application Traceback (most recent call last): File "/opt/render/project/src/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/routing.py", line 758, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/routing.py", line 778, in app await route.handle(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle await self.app(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/routing.py", line 79, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/render/project/src/.venv/lib/python3.11/site-packages/starlette/routing.py", line 74, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/main.py", line 60, in handle_callback await line_bot_api.reply_message( File "/opt/render/project/src/.venv/lib/python3.11/site-packages/linebot/v3/messaging/async_api_client.py", line 219, in __call_api response_data = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/linebot/v3/messaging/async_rest.py", line 224, in post_request return (await self.request("POST", url, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/linebot/v3/messaging/async_rest.py", line 171, in request r = await self.pool_manager.request(**args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/render/project/src/.venv/lib/python3.11/site-packages/aiohttp/client.py", line 504, in _request with timer: File "/opt/render/project/src/.venv/lib/python3.11/site-packages/aiohttp/helpers.py", line 715, in __enter__ raise RuntimeError( RuntimeError: Timeout context manager should be used inside a task
0 コメント