lnbits / lndhub

Access lnbits from BlueWallet or Zeus
MIT License
2 stars 6 forks source link

Bluewallet API failure #4

Closed 20a8vnf30 closed 1 year ago

20a8vnf30 commented 1 year ago

Copy of https://github.com/lnbits/lnbits/issues/1172

Updated to lnbits 0.10. I'm no longer able to import an LNbits wallet into Bluewallet by scanning the LNDhub admin QR or invoice QR. After scanning the QR Bluewallet reports: "import error, undefined is not a function".

Trying to sync or generate an invoice for the same wallet that was previously imported into Bluewallet under LNbits 0.9.7 throws an error in the LNbits log:

Mar 05 21:05:09 NUC uvicorn[675860]: Traceback (most recent call last):
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, _send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "./lnbits/middleware.py", line 73, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "./lnbits/middleware.py", line 52, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 24, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await responder(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 43, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, self.send_with_gzip)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     raise exc
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, sender)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     raise e
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
Mar 05 21:05:09 NUC uvicorn[675860]:     await route.handle(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
Mar 05 21:05:09 NUC uvicorn[675860]:     await self.app(scope, receive, send)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
Mar 05 21:05:09 NUC uvicorn[675860]:     response = await func(request)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/fastapi/routing.py", line 231, in app
Mar 05 21:05:09 NUC uvicorn[675860]:     raw_response = await run_endpoint_function(
Mar 05 21:05:09 NUC uvicorn[675860]:   File "/bitcoin/lnbits/venv/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
Mar 05 21:05:09 NUC uvicorn[675860]:     return await dependant.call(**values)
Mar 05 21:05:09 NUC uvicorn[675860]:   File "./lnbits/extensions/lndhub/views_api.py", line 181, in lndhub_getuserinvoices
Mar 05 21:05:09 NUC uvicorn[675860]:     return [
Mar 05 21:05:09 NUC uvicorn[675860]:   File "./lnbits/extensions/lndhub/views_api.py", line 183, in <listcomp>
Mar 05 21:05:09 NUC uvicorn[675860]:     "r_hash": to_buffer(invoice.payment_hash),
Mar 05 21:05:09 NUC uvicorn[675860]:   File "./lnbits/extensions/lndhub/utils.py", line 5, in to_buffer
Mar 05 21:05:09 NUC uvicorn[675860]:     return {"type": "Buffer", "data": [b for b in bytes.fromhex(payment_hash)]}
Mar 05 21:05:09 NUC uvicorn[675860]: ValueError: non-hexadecimal number found in fromhex() arg at position 2
Mar 05 21:05:09 NUC uvicorn[675860]: 2023-03-05 21:05:09.56 | ERROR | Exception: non-hexadecimal number found in fromhex() arg at position 2
Mar 05 21:05:09 NUC uvicorn[675860]: 2023-03-05 21:05:09.56 | INFO | [removed to not dox IP] - "GET /lndhub/ext/getuserinvoices?limit=20 HTTP/1.0" 500
Mar 05 21:05:09 NUC uvicorn[675860]: 2023-03-05 21:05:09.56 | ERROR | Exception in ASGI application

Importing the same LNbits wallet into Zeus mobile and generating an invoice works with no problem.

bota87 commented 1 year ago

I'm having similar problem but different error: when I scan the admin or invoice qr code on BlueWallet I get "import error Network request failed", nothing is logged on lnbits so I'm unsure if it's a BlueWallet or LndHub issue. The same qr code works for Zeus

dni commented 1 year ago

i think this PR should fix the issue: https://github.com/lnbits/lnbits/pull/1588

dni commented 1 year ago

I'm having similar problem but different error: when I scan the admin or invoice qr code on BlueWallet I get "import error Network request failed", nothing is logged on lnbits so I'm unsure if it's a BlueWallet or LndHub issue. The same qr code works for Zeus

hm, i think this one is unrelated to the orignal issue

bota87 commented 1 year ago

I use a self signed certificate, maybe that's the problem? I'm looking for an option to disable the certificate verification like in zeus but I'm not finding it

20a8vnf30 commented 1 year ago

Updated to LNbits 0.10.4, the error has changed but is not resolved. I tried adding an LNbits wallet to Bluewallet by scanning the LNDhub admin QR. LNbits log:

Apr 23 17:18:27 NUC poetry[252134]: 2023-04-23 17:18:27.68 | INFO | 143.177.232.36:0 - "POST /lndhub/ext/auth?type=auth HTTP/1.0" 200
Apr 23 17:18:27 NUC poetry[252134]: Traceback (most recent call last):
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, _send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/bitcoin/lnbits/lnbits/middleware.py", line 131, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/bitcoin/lnbits/lnbits/middleware.py", line 63, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 24, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await responder(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 43, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, self.send_with_gzip)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     raise exc
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, sender)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     raise e
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
Apr 23 17:18:27 NUC poetry[252134]:     await route.handle(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
Apr 23 17:18:27 NUC poetry[252134]:     await self.app(scope, receive, send)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
Apr 23 17:18:27 NUC poetry[252134]:     response = await func(request)
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 231, in app
Apr 23 17:18:27 NUC poetry[252134]:     raw_response = await run_endpoint_function(
Apr 23 17:18:27 NUC poetry[252134]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
Apr 23 17:18:27 NUC poetry[252134]:     return await dependant.call(**values)
Apr 23 17:18:27 NUC poetry[252134]:   File "/bitcoin/lnbits/lnbits/extensions/lndhub/views_api.py", line 121, in lndhub_gettxs
Apr 23 17:18:27 NUC poetry[252134]:     for payment in await get_payments(
Apr 23 17:18:27 NUC poetry[252134]: TypeError: get_payments() got an unexpected keyword argument 'limit'
Apr 23 17:18:27 NUC poetry[252134]: 2023-04-23 17:18:27.71 | ERROR | Exception: get_payments() got an unexpected keyword argument 'limit'
Apr 23 17:18:27 NUC poetry[252134]: 2023-04-23 17:18:27.71 | INFO | [removed to not dox IP] - "GET /lndhub/ext/gettxs?limit=10&offset=0 HTTP/1.0" 500
Apr 23 17:18:27 NUC poetry[252134]: 2023-04-23 17:18:27.71 | ERROR | Exception in ASGI application

The error displayed in Bluewallet:

Screenshot_20230423_171155_BlueWallet

talvasconcelos commented 1 year ago

Fixed with lnbits/lnbits#1613

20a8vnf30 commented 1 year ago

I'm still experiencing this issue with my admin wallet after updating to 0.10.8. I open the LNDhub extension as the admin/superuser, use the Bluewallet import function to scan the admin QR, Bluewallet throws an error: "Import error" "undefined is not a function" The relevant LNbits log lines are below.

My admin/superuser has one wallet, the wallet has had several topups over the last few months, it has done boltcard payments, received some sats and paid some invoices, it has done a total of 20 transactions. Wallets from other users don't have this problem and can be imported into Bluewallet just fine.

Jun 02 18:46:55 NUC poetry[2184805]: 2023-06-02 18:46:55.65 | INFO | 143.177.232.36:0 - "POST /lndhub/ext/auth?type=auth HTTP/1.0" 200
Jun 02 18:46:55 NUC poetry[2184805]: 2023-06-02 18:46:55.67 | INFO | 143.177.232.36:0 - "GET /lndhub/ext/gettxs?limit=10&offset=0 HTTP/1.0" 200
Jun 02 18:46:55 NUC poetry[2184805]: Traceback (most recent call last):
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, _send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/bitcoin/lnbits/lnbits/middleware.py", line 131, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/bitcoin/lnbits/lnbits/middleware.py", line 63, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 24, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await responder(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/gzip.py", line 43, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, self.send_with_gzip)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     raise exc
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, sender)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     raise e
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
Jun 02 18:46:55 NUC poetry[2184805]:     await route.handle(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
Jun 02 18:46:55 NUC poetry[2184805]:     await self.app(scope, receive, send)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
Jun 02 18:46:55 NUC poetry[2184805]:     response = await func(request)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 231, in app
Jun 02 18:46:55 NUC poetry[2184805]:     raw_response = await run_endpoint_function(
Jun 02 18:46:55 NUC poetry[2184805]:   File "/home/lnbits/.cache/pypoetry/virtualenvs/lnbits-N2LfHUJp-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
Jun 02 18:46:55 NUC poetry[2184805]:     return await dependant.call(**values)
Jun 02 18:46:55 NUC poetry[2184805]:   File "/bitcoin/lnbits/lnbits/extensions/lndhub/views_api.py", line 181, in lndhub_getuserinvoices
Jun 02 18:46:55 NUC poetry[2184805]:     return [
Jun 02 18:46:55 NUC poetry[2184805]:   File "/bitcoin/lnbits/lnbits/extensions/lndhub/views_api.py", line 183, in <listcomp>
Jun 02 18:46:55 NUC poetry[2184805]:     "r_hash": to_buffer(invoice.payment_hash),
Jun 02 18:46:55 NUC poetry[2184805]:   File "/bitcoin/lnbits/lnbits/extensions/lndhub/utils.py", line 5, in to_buffer
Jun 02 18:46:55 NUC poetry[2184805]:     return {"type": "Buffer", "data": [b for b in bytes.fromhex(payment_hash)]}
Jun 02 18:46:55 NUC poetry[2184805]: ValueError: non-hexadecimal number found in fromhex() arg at position 2
Jun 02 18:46:55 NUC poetry[2184805]: 2023-06-02 18:46:55.70 | ERROR | Exception: non-hexadecimal number found in fromhex() arg at position 2
Jun 02 18:46:55 NUC poetry[2184805]: 2023-06-02 18:46:55.71 | INFO | [removed to not dox IP] - "GET /lndhub/ext/getuserinvoices HTTP/1.0" 500
Jun 02 18:46:55 NUC poetry[2184805]: 2023-06-02 18:46:55.71 | ERROR | Exception in ASGI application
20a8vnf30 commented 1 year ago

@talvasconcelos Could you reopen this issue or should I make a new one?