fiatjaf / sparko

c-lightning RPC over HTTP with fine-grained permissions, SSE and spark-wallet support
38 stars 12 forks source link

Spark UI fails to finish loading #4

Closed will123195 closed 3 years ago

will123195 commented 3 years ago

Awesome job on sparko! However, the UI seems to be broken for me.

It shows a perpetual spinner and there are errors in the console:

image

There are no errors in the logs:

plugin-sparko  initialized plugin v2.5
plugin-sparko  Login credentials read: redacted:redacted (full-access key: redacted)
plugin-sparko 1 keys read: redacted (full-access)
plugin-sparko  HTTP server on http://0.0.0.0:9737/

and the RPC endpoint seems to be working fine:

curl http://lightning.example.com/rpc -d '{"method": "getinfo"}' -H 'X-Access: redacted'
{"id":"03358ee4d8882672cb6289f854fa797b12d89e752a8c3bcba259fb77706957c02b","alias":"SLICKERMONTANA","color":"03358e","num_peers":0,"num_pending_channels":0,"num_active_channels":0,"num_inactive_channels":0,"address":[],"binding":[{"type":"ipv6","address":"::","port":9735},{"type":"ipv4","address":"0.0.0.0","port":9735}],"version":"v0.9.2","blockheight":659451,"network":"bitcoin","msatoshi_fees_collected":0,"fees_collected_msat":"0msat","lightning-dir":"/root/.lightning/bitcoin"}

Any ideas? Thanks!

fiatjaf commented 3 years ago

I've just published a version that comes with a "development" version of the underlying spark-wallet UI: https://github.com/fiatjaf/sparko/releases/download/v2.5/sparko-client-debug. It should hopefully show errors that are slightly less impossible to understand.

Can you run it and come back with more of these console errors? (You may have to run it on an incognito tab or something like that because the client caches its own resources, I'm not sure how that works but it seems to interfere with the loading of the new "development" javascripts).

(If you want to build it by yourself run make sparko-client-debug.)

will123195 commented 3 years ago

image

Here's a reproducible example using the development version of sparko (you just need to plug in your own bitcoin-rpc values):

docker run -it -p 9737:9737 hotwallet/lightningd:dev lightningd \
--bitcoin-rpcconnect=bitcoind.example.com \
--bitcoin-rpcuser=rpcuser \
--bitcoin-rpcpassword=rpcpassword \
--network=bitcoin \
--log-level=debug \
--sparko-login=mywalletusername:mywalletpassword \
--sparko-keys=masterkeythatcandoeverything \
--sparko-port=9737 \
--sparko-host=0.0.0.0

Here's the Dockerfile if you want to build the image yourself: https://github.com/hotwallet/lightningd/blob/main/Dockerfile (you'll just need to swap in the development sparko release here)

fiatjaf commented 3 years ago

Well, that wasn't very helpful :stuck_out_tongue:

The error is happening deep inside rxjs or some other library that spark-wallet uses, so I don't know what to do.

Thank you for the reproducible thing. I had tried to reproduce it locally already, but I will try to reproduce again, however I don't have docker and all my past experiences with it were a nightmare, so I will try to reproduce without docker, which may fail miserably.

Did you try on a different browser?

fiatjaf commented 3 years ago

Now I'm thinking it may be related to an /rpc call returning null instead of [] somewhere. Can you check the "Network" tab and see if this is happening?

will123195 commented 3 years ago

Here are the rpc responses:

listinvoices --> {"invoices":[]} listpaysext --> [] getinfo --> {"id": ...} listpeers --> {"peers":[]} listfunds --> {"outputs":[],"channels":[]}

They are all objects except listpaysext. My hunch is it's supposed to be {"pays":[]} instead of [].

Also, after funding a channel and making a payment the UI is now loading.

fiatjaf commented 3 years ago

Thank you! Yes, that was it, I'm 99% sure.