Ride-The-Lightning / RTL

Ride The Lightning - A full function web browser app for LND, C-Lightning and Eclair
MIT License
731 stars 156 forks source link

Error 404 when I login #1405

Closed ElucGeek closed 2 weeks ago

ElucGeek commented 2 weeks ago

Describe the bug I have a problem to connect RTL to my CLN. I setup the rune, it looks like working first but when I login on the webUI, I get a 404 error. In the log it's not helping much:

ERROR: GetInfo => Get Info Error: {"name":"StatusCodeError","statusCode":404,"message":"404 - \"<!DOCTYPE html>\\n<html lang=\\\"en\\\">\\n<head>\\n<meta charset=\\\"utf-8\\\">\\n<title>Error</title>\\n</head>\\n<body>\\n<pre>Cannot POST /v1/getinfo</pre>\\n</body>\\n</html>\\n\"","error":"404 - \"<!DOCTYPE html>\\n<html lang=\\\"en\\\">\\n<head>\\n<meta charset=\\\"utf-8\\\">\\n<title>Error</title>\\n</head>\\n<body>\\n<pre>Cannot POST /v1/getinfo</pre>\\n</body>\\n</html>\\n\"","options":{"url":"https://localhost:3001/v1/getinfo","rejectUnauthorized":false,"json":true,"headers":{"rune":"XXXXXXXXXXXXXXXXXXXXXXXXXXXX=="},"method":"POST","qs":{},"simple":true,"resolveWithFullResponse":false,"transform2xxOnly":false},"response":{"statusCode":404,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /v1/getinfo</pre>\n</body>\n</html>\n","headers":{"x-powered-by":"Express","access-control-allow-origin":"*","access-control-allow-headers":"Origin, X-Requested-With, Content-Type, Accept, Authorization, filePath, macaroon, encodingtype","access-control-allow-methods":"GET, POST, PATCH, PUT, DELETE, OPTIONS","content-security-policy":"default-src 'none'","x-content-type-options":"nosniff","content-type":"text/html; charset=utf-8","content-length":"150","date":"Thu, 06 Jun 2024 19:53:37 GMT","connection":"close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"localhost:3001","port":"3001","hostname":"localhost","hash":null,"search":null,"query":null,"pathname":"/v1/getinfo","path":"/v1/getinfo","href":"https://localhost:3001/v1/getinfo"},"method":"POST","headers":{"rune":"XXXXXXXXXXXXXXXXXXXXXXXXX==","accept":"application/json","content-length":0}}}}

To Reproduce Steps to reproduce the behavior:

  1. login to RTL

My RTL config: { "port": "3000", "defaultNodeIndex": 1, "dbDirectoryPath": "/home/rtl/rtl-db", "SSO": { "rtlSSO": 0, "rtlCookiePath": "", "logoutRedirectLink": "" }, "nodes": [ { "index": 1, "lnNode": "mynode", "lnImplementation": "CLN", "Authentication": { "runePath": "/home/rtl/rune-fullaccess", "configPath": "/home/lightning/.lightning/config" }, "Settings": { "userPersona": "OPERATOR", "themeMode": "NIGHT", "themeColor": "PURPLE", "channelBackupPath": "/home/rtl/backup-rtl", "logLevel": "DEBUG", "lnServerUrl": "https://localhost:3001", "fiatConversion": false, "unannouncedChannels": false } } ],

Screenshots none

Your environment

Additional context Any clue were is the problem comes form? My config file? CLN config?

ShahanaFarooqui commented 2 weeks ago

Seems like the rune is incorrect or not saved in the file in correct format (eg. LIGHTNING_RUNE="mRX...24j").

ElucGeek commented 2 weeks ago

Seems like the rune is incorrect or not saved in the file in correct format (eg. LIGHTNING_RUNE="mRX...24j").

It's exactly that: LIGHTNING_RUNE="XXXXXXXXXXXXXXXXXXXXX==" That's the content of the file /home/rtl/run-fullaccess which is read only for user rtl only which is running rtl. Other clue? Is it the c-lightning-REST which is messing up? I cannot have both c-lightning-REST and CLNrest in CLN? In RTL I configured only the rune, so it should be ok, right?

ShahanaFarooqui commented 2 weeks ago

c-lightning-REST could not be the problem. Both c-lightning-REST and CLNRest can run on the same node without any issue.

For RTL, you only need runePath, no more macaroonPath for CLN.

Can you check if you are using a valid rune (showrunes or decode)?

Did you update your lnServerUrl from older c-lightning-REST's url to the new clnrest's server url?

ElucGeek commented 2 weeks ago

c-lightning-REST could not be the problem. Both c-lightning-REST and CLNRest can run on the same node without any issue.

For RTL, you only need runePath, no more macaroonPath for CLN.

Can you check if you are using a valid rune (showrunes or decode)?

Did you update your lnServerUrl from older c-lightning-REST's url to the new clnrest's server url?

This is my rune (without the secret of course):

{ "runes": [ { "rune": "djdkjdkj..SECRET...dkjdkj==", "unique_id": "0", "restrictions": [], "restrictions_as_english": "" } ] } Looks good to me, no?

I was wondering if it has something to do with port, should I set a different port for CLNrest in my CLN config? I have this: `# REST Server rest-port=3001

rest-docport=4001

rest-protocol=https

` Is there something else needed for the CLNrest rune (this naming is so confusing to me)? If I try to add clnrest-port=3010, cln don't want to start anymore.

ElucGeek commented 2 weeks ago

Ok I manager to solve it as follow: 1) I install the following missing dependencies as the user running lighting: pip3 install --user flask-cors flask_restx pyln-client flask-socketio gevent gevent-websocket 2) I added these lines to the lightning config file clnrest-port=3010 clnrest-host=0.0.0.0 clnrest-prototcol=https

Note that the clnrest-host might not be necessary, I guess it's for external access but not 100% sure. you can try to remove it if you don't need external access.

3) I changed the port in the config file of RTL: "lnServerUrl": "https://localhost:3010",

I restarted cln and rtl, and both are running.

Now I can login to RTL and see my node, generate on-chain address, open a channel...