janoside / lndash

Admin UI for LND
https://lnd-admin.btc21.org
MIT License
76 stars 24 forks source link

My Wallet error #27

Closed Espen11 closed 5 years ago

Espen11 commented 5 years ago

v0.10.6 My Wallet page does not display. Connected to one remote raspiblitz node with one confirmed transaction, one UTXO and one offline channel on it. When I click on "My Wallet" it rotates between the following 3 errors:

#################################################################

TypeError: /home/espen/lnd-admin/views/wallet.pug:39 37| span.border-dotted(data-toggle="tooltip" title="The value in your wallet that's not currently committed to any payment channels.") Balance 38| div.summary-table-content.text-monospace

39| - var currencyValue = new Decimal(walletBalance.confirmed_balance).dividedBy(coinConfig.baseCurrencyUnit.multiplier); 40| include includes/value-display.pug 41| 42| if (walletBalance.unconfirmed_balance > 0)

Cannot read property 'confirmed_balance' of undefined at eval (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :1333:47) at template (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :4536:77) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:427:38) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:417:21) at exports.__express (/home/espen/lnd-admin/node_modules/pug/lib/index.js:464:11) at View.app.engine (/home/espen/lnd-admin/app.js:56:23) at View.render (/home/espen/lnd-admin/node_modules/express/lib/view.js:135:8) at tryRender (/home/espen/lnd-admin/node_modules/express/lib/application.js:640:10) at Function.render (/home/espen/lnd-admin/node_modules/express/lib/application.js:592:3) at ServerResponse.render (/home/espen/lnd-admin/node_modules/express/lib/response.js:1008:7)

#################################################################

TypeError: /home/espen/lnd-admin/views/wallet.pug:24 22| 23| - var unconfirmedTxCount = 0;

24| each tx, index in onChainTransactions.transactions 25| if (tx.num_confirmations == 0) 26| - unconfirmedTxCount++; 27|

Cannot read property 'transactions' of undefined at eval (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :1286:35) at eval (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :1308:4) at template (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :4536:77) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:427:38) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:417:21) at exports.__express (/home/espen/lnd-admin/node_modules/pug/lib/index.js:464:11) at View.app.engine (/home/espen/lnd-admin/app.js:56:23) at View.render (/home/espen/lnd-admin/node_modules/express/lib/view.js:135:8) at tryRender (/home/espen/lnd-admin/node_modules/express/lib/application.js:640:10) at Function.render (/home/espen/lnd-admin/node_modules/express/lib/application.js:592:3)

#################################################################

TypeError: /home/espen/lnd-admin/views/wallet.pug:51 49| div.summary-table-label 50| span.border-dotted(title="Number of unspent transactions outputs." data-toggle="tooltip") UTXOs

51| div.summary-table-content.text-monospace #{walletUtxosResponse.utxos.length.toLocaleString()} 52| 53| div.summary-table-label Transactions 54| div.summary-table-content.text-monospace #{confirmedTxCount.toLocaleString()}

Cannot read property 'utxos' of undefined at eval (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :1446:77) at template (eval at wrap (/home/espen/lnd-admin/node_modules/pug-runtime/wrap.js:6:10), :4536:77) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:427:38) at Object.exports.renderFile (/home/espen/lnd-admin/node_modules/pug/lib/index.js:417:21) at exports.__express (/home/espen/lnd-admin/node_modules/pug/lib/index.js:464:11) at View.app.engine (/home/espen/lnd-admin/app.js:56:23) at View.render (/home/espen/lnd-admin/node_modules/express/lib/view.js:135:8) at tryRender (/home/espen/lnd-admin/node_modules/express/lib/application.js:640:10) at Function.render (/home/espen/lnd-admin/node_modules/express/lib/application.js:592:3) at ServerResponse.render (/home/espen/lnd-admin/node_modules/express/lib/response.js:1008:7)

#################################################################

Espen11 commented 5 years ago

/error-log gives me this:

Error Details

{ "code": 12, "metadata": { "_internal_repr": {} }, "details": "unknown service lnrpc.Lightning" }

Stacktrace

Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning at Object.exports.createStatusError (/home/espen/lnd-admin/node_modules/grpc/src/common.js:91:15) at Object.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:1204:28) at InterceptingListener._callNext (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:568:42) at InterceptingListener.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:618:8) at callback (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:845:24)

janoside commented 5 years ago

Are any other parts of the app working for you? The error "unknown service lnrpc.Lightning" seems to indicate that rpc.proto (the protocol file for the RPC API to LND) didn't load properly. Also, what version of LND are you connecting to in this case, just for reference?

Espen11 commented 5 years ago

RaspiBlitz 1.0 LND 0.5.2-beta

All other pages works fine. Lists peers, channels and can create invoices.

janoside commented 5 years ago

Thanks for that info. Does restarting the app improve the situation at all? Also, during startup are there any errors logged? You may need to set an environment variable to see all logging, for example if you installed via NPM, if you run it like below, you should see all the logging for the app printed to stdout:

DEBUG=lnd-admin:* lnd-admin

Espen11 commented 5 years ago

Turned on DEBUG and restarting gives me the same. I also did some more transactions on the node and added some more UTXOs, so not only the one anymore. No startup errors or warnings.

stdout: lnd-admin:error Error 3420d8hfsdhs0: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning, json: {"code":12,"metadata":{"_internal_repr":{}},"details":"unknown service lnrpc.Lightning"} +5s lnd-admin:error Stack: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning lnd-admin:error at Object.exports.createStatusError (/home/espen/lnd-admin/node_modules/grpc/src/common.js:91:15) lnd-admin:error at Object.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:1204:28) lnd-admin:error at InterceptingListener._callNext (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:568:42) lnd-admin:error at InterceptingListener.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:618:8) lnd-admin:error at callback (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:845:24) +0ms lnd-admin:error Error 32078sdhsghgsh: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning, json: {"code":12,"metadata":{"_internal_repr":{}},"details":"unknown service lnrpc.Lightning"} +0ms lnd-admin:error Stack: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning lnd-admin:error at Object.exports.createStatusError (/home/espen/lnd-admin/node_modules/grpc/src/common.js:91:15) lnd-admin:error at Object.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:1204:28) lnd-admin:error at InterceptingListener._callNext (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:568:42) lnd-admin:error at InterceptingListener.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:618:8) lnd-admin:error at callback (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:845:24) +0ms lnd-admin:error Error 3r9ygew9fgvew9fd: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning, json: {"code":12,"metadata":{"_internal_repr":{}},"details":"unknown service lnrpc.Lightning"} +1ms lnd-admin:error Stack: Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning lnd-admin:error at Object.exports.createStatusError (/home/espen/lnd-admin/node_modules/grpc/src/common.js:91:15) lnd-admin:error at Object.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:1204:28) lnd-admin:error at InterceptingListener._callNext (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:568:42) lnd-admin:error at InterceptingListener.onReceiveStatus (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:618:8) lnd-admin:error at callback (/home/espen/lnd-admin/node_modules/grpc/src/client_interceptors.js:845:24) +0ms

janoside commented 5 years ago

I'm still confused about the errors you're seeing. If you update to 0.10.7 there are some changes that I expect will affect what you're seeing, but no root-cause fixes. If you update, let me know how things are looking here.

Espen11 commented 5 years ago

Now running 0.10.7. Still get the Error. It's not rotating anymore, just the same error now:

TypeError: /home/espen/lnd-admin2/views/wallet.pug:81 79| code.json.bg-light #{JSON.stringify(walletUtxosResponse, null, 4)} 80|

81| if (walletUtxosResponse.utxos.length > 0) 82| div.card.shadow-sm.mb-3 83| div.card-header 84| h3.h6.mb-0 #{walletUtxosResponse.utxos.length.toLocaleString()} UTXOs

Cannot read property 'utxos' of undefined at eval (eval at wrap (/home/espen/lnd-admin2/node_modules/pug-runtime/wrap.js:6:10), :1620:26) at template (eval at wrap (/home/espen/lnd-admin2/node_modules/pug-runtime/wrap.js:6:10), :4700:77) at Object.exports.renderFile (/home/espen/lnd-admin2/node_modules/pug/lib/index.js:427:38) at Object.exports.renderFile (/home/espen/lnd-admin2/node_modules/pug/lib/index.js:417:21) at exports.__express (/home/espen/lnd-admin2/node_modules/pug/lib/index.js:464:11) at View.app.engine (/home/espen/lnd-admin2/app.js:63:23) at View.render (/home/espen/lnd-admin2/node_modules/express/lib/view.js:135:8) at tryRender (/home/espen/lnd-admin2/node_modules/express/lib/application.js:640:10) at Function.render (/home/espen/lnd-admin2/node_modules/express/lib/application.js:592:3) at ServerResponse.render (/home/espen/lnd-admin2/node_modules/express/lib/response.js:1008:7)

############################ This part is the same:

Error Details

{ "code": 12, "metadata": { "_internal_repr": {} }, "details": "unknown service lnrpc.Lightning" }

Stacktrace

Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning at Object.exports.createStatusError (/home/espen/lnd-admin2/node_modules/grpc/src/common.js:91:15) at Object.onReceiveStatus (/home/espen/lnd-admin2/node_modules/grpc/src/client_interceptors.js:1204:28) at InterceptingListener._callNext (/home/espen/lnd-admin2/node_modules/grpc/src/client_interceptors.js:568:42) at InterceptingListener.onReceiveStatus (/home/espen/lnd-admin2/node_modules/grpc/src/client_interceptors.js:618:8) at callback (/home/espen/lnd-admin2/node_modules/grpc/src/client_interceptors.js:845:24)

Espen11 commented 5 years ago

After some more troubleshooting and isolating code I found that "walletUtxosResponse.utxos.length.toLocaleString()" returns "Unknown". I have no idea why that works on line 57 and why utxos is undefined on line 81, 84 etc.

If I remove the section with the "UTXOs" list and the page renders fine (see screenshot), but with the error log I posted above. lnd-1

janoside commented 5 years ago

Thanks for this troubleshooting and thanks for the screenshot. What you're seeing there is part of my goal: to gracefully fail in the event that some, but not all, of the underlying data for the page fails to load from LND. The "Unknown" you're seeing there is the result of recent changes I made to address your specific issue and I plan to do more along the same lines - again, with the goal of gracefully failing. Of course, I still want to address the root-cause errors you're hitting...to be continued.

Espen11 commented 5 years ago

Ahh.. I think I found it... ListUnspent was introduced in LND 0.6.0 My RaspiBlizt is on 0.5.2

janoside commented 5 years ago

Ah-ha! Makes sense now...and good to know. The graceful-fail work done here is valuable regardless and now I should probably do a little more to more carefully handle version mismatching between my API and the running LND...

janoside commented 5 years ago

I believe the recent change #bfe91f1 (included in 0.10.8) will let you drop your local modifications to wallet.pug, FYI.

Espen11 commented 5 years ago

Perfect. Works like a charm now. Thanks.