fusion44 / blitz_api

A management backend for the RaspiBlitz project written in Python / FastAPI
MIT License
18 stars 18 forks source link

list-all-tx 500 on lnd startup #247

Open cstenglein opened 5 months ago

cstenglein commented 5 months ago

If the LND RPC server ist just starting up, then the API just returns 500 without any hint:

LND side:

[ERR] RPCS: [/lnrpc.Lightning/ListPayments]: the RPC server is in the process of starting up, but not yet ready to accept calls

API error log:

Feb 26 05:45:21 raspberrypi python[1371]: 2024-02-26 05:45:21 | ℹ | logging.py:87 | 127.0.0.1:53840 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
Feb 26 05:45:41 raspberrypi python[1371]: 2024-02-26 05:45:41 | ℹ | logging.py:87 | 127.0.0.1:33308 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
Feb 26 05:46:01 raspberrypi python[1371]: 2024-02-26 05:46:01 | ℹ | logging.py:87 | 127.0.0.1:40056 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
Feb 26 05:46:21 raspberrypi python[1371]: 2024-02-26 05:46:21 | ℹ | logging.py:87 | 127.0.0.1:52258 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
rootzoll commented 4 months ago
Mar 10 19:54:26 raspberrypi python[124058]:     result = await app(  # type: ignore[func-returns-value]
Mar 10 19:54:26 raspberrypi python[124058]:                    └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fadc6efd0>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     return await self.app(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:                  │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:                  │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:                  │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:                  │    └ <fastapi.applications.FastAPI object at 0x7fab7fba90>
Mar 10 19:54:26 raspberrypi python[124058]:                  └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7fadc6efd0>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await super().__call__(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:                            │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:                            │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:                            └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await self.middleware_stack(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fab6d8f90>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <fastapi.applications.FastAPI object at 0x7fab7fba90>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await self.app(scope, receive, _send)
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7faa7537e0>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │    └ <starlette.middleware.cors.CORSMiddleware object at 0x7fab6cb490>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7fab6d8f90>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await self.app(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7faa7537e0>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7faa7f5750>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <starlette.middleware.cors.CORSMiddleware object at 0x7fab6cb490>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │    │     │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7faa7537e0>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │    │     │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │    └ <starlette.requests.Request object at 0x7faa5f88d0>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    └ <fastapi.routing.APIRouter object at 0x7fadc6fd10>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7faa7f5750>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <function wrap_app_handling_exceptions at 0x7facd9a700>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Mar 10 19:54:26 raspberrypi python[124058]:     await app(scope, receive, sender)
Mar 10 19:54:26 raspberrypi python[124058]:           │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66ed40>
Mar 10 19:54:26 raspberrypi python[124058]:           │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           └ <fastapi.routing.APIRouter object at 0x7fadc6fd10>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/routing.py", line 758, in __call__
Mar 10 19:54:26 raspberrypi python[124058]:     await self.middleware_stack(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66ed40>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7fadc6fd10>>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <fastapi.routing.APIRouter object at 0x7fadc6fd10>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
Mar 10 19:54:26 raspberrypi python[124058]:     await route.handle(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66ed40>
Mar 10 19:54:26 raspberrypi python[124058]:           │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │     └ <function Route.handle at 0x7faccb9ee0>
Mar 10 19:54:26 raspberrypi python[124058]:           └ APIRoute(path='/lightning/list-all-tx', name='lightning.list-all-tx', methods=['GET'])
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
Mar 10 19:54:26 raspberrypi python[124058]:     await self.app(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66ed40>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │    └ <function request_response.<locals>.app at 0x7faa7199e0>
Mar 10 19:54:26 raspberrypi python[124058]:           └ APIRoute(path='/lightning/list-all-tx', name='lightning.list-all-tx', methods=['GET'])
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
Mar 10 19:54:26 raspberrypi python[124058]:     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66ed40>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │        │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           │                            │    └ <starlette.requests.Request object at 0x7faa60f110>
Mar 10 19:54:26 raspberrypi python[124058]:           │                            └ <function request_response.<locals>.app.<locals>.app at 0x7faa66e020>
Mar 10 19:54:26 raspberrypi python[124058]:           └ <function wrap_app_handling_exceptions at 0x7facd9a700>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Mar 10 19:54:26 raspberrypi python[124058]:     await app(scope, receive, sender)
Mar 10 19:54:26 raspberrypi python[124058]:           │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7faa66df80>
Mar 10 19:54:26 raspberrypi python[124058]:           │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0x7faa5eeb50>>
Mar 10 19:54:26 raspberrypi python[124058]:           │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.0', 'server': ('127.0.0.1', 11111), 'c...
Mar 10 19:54:26 raspberrypi python[124058]:           └ <function request_response.<locals>.app.<locals>.app at 0x7faa66e020>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
Mar 10 19:54:26 raspberrypi python[124058]:     response = await func(request)
Mar 10 19:54:26 raspberrypi python[124058]:                      │    └ <starlette.requests.Request object at 0x7faa60f110>
Mar 10 19:54:26 raspberrypi python[124058]:                      └ <function get_request_handler.<locals>.app at 0x7faa718680>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
Mar 10 19:54:26 raspberrypi python[124058]:     raw_response = await run_endpoint_function(
Mar 10 19:54:26 raspberrypi python[124058]:                          └ <function run_endpoint_function at 0x7faccb99e0>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/venv/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
Mar 10 19:54:26 raspberrypi python[124058]:     return await dependant.call(**values)
Mar 10 19:54:26 raspberrypi python[124058]:                  │         │      └ {'successful_only': False, 'index_offset': 0, 'max_tx': 0, 'reversed': True}
Mar 10 19:54:26 raspberrypi python[124058]:                  │         └ <function list_all_tx_path at 0x7faa812f20>
Mar 10 19:54:26 raspberrypi python[124058]:                  └ <fastapi.dependencies.models.Dependant object at 0x7faa74b250>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/app/lightning/router.py", line 173, in list_all_tx_path
Mar 10 19:54:26 raspberrypi python[124058]:     return await list_all_tx(successful_only, index_offset, max_tx, reversed)
Mar 10 19:54:26 raspberrypi python[124058]:                  │           │                │             │       └ True
Mar 10 19:54:26 raspberrypi python[124058]:                  │           │                │             └ 0
Mar 10 19:54:26 raspberrypi python[124058]:                  │           │                └ 0
Mar 10 19:54:26 raspberrypi python[124058]:                  │           └ False
Mar 10 19:54:26 raspberrypi python[124058]:                  └ <function list_all_tx at 0x7faa9dd8a0>
Mar 10 19:54:26 raspberrypi python[124058]: > File "/home/blitzapi/blitz_api/app/lightning/service.py", line 88, in list_all_tx
Mar 10 19:54:26 raspberrypi python[124058]:     return await ln.list_all_tx(successful_only, index_offset, max_tx, reversed)
Mar 10 19:54:26 raspberrypi python[124058]:                  │  │           │                │             │       └ True
Mar 10 19:54:26 raspberrypi python[124058]:                  │  │           │                │             └ 0
Mar 10 19:54:26 raspberrypi python[124058]:                  │  │           │                └ 0
Mar 10 19:54:26 raspberrypi python[124058]:                  │  │           └ False
Mar 10 19:54:26 raspberrypi python[124058]:                  │  └ <function LnNodeLNDgRPC.list_all_tx at 0x7faa9ed4e0>
Mar 10 19:54:26 raspberrypi python[124058]:                  └ <app.lightning.impl.lnd_grpc.LnNodeLNDgRPC object at 0x7fabb9e210>
Mar 10 19:54:26 raspberrypi python[124058]:   File "/home/blitzapi/blitz_api/app/lightning/impl/lnd_grpc.py", line 354, in list_all_tx
Mar 10 19:54:26 raspberrypi python[124058]:     comment = pr.description
Mar 10 19:54:26 raspberrypi python[124058]:               └ None
Mar 10 19:54:26 raspberrypi python[124058]: AttributeError: 'NoneType' object has no attribute 'description'
Mar 10 19:54:26 raspberrypi python[124058]:
Mar 10 19:54:26 raspberrypi python[124058]: 2024-03-10 19:54:26 | ℹ️ | logging.py:87 | 127.0.0.1:59236 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
Mar 10 19:54:26 raspberrypi python[124058]: 2024-03-10 19:54:26 | ❌ | logging.py:87 | Exception in ASGI application
Mar 10 19:54:26 raspberrypi python[124058]:
fusion44 commented 4 months ago

They are two different problems, though.